Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add check for comments in PR description #10

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
✨ Add check for comments in PR description
  • Loading branch information
paranoidsp committed Oct 6, 2020
commit 6d86f0bc89376137069433081b1dfb4ace5fb63f
4 changes: 4 additions & 0 deletions verify/cmd/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func main() {
errs = append(errs, "**Your PR has an issue number in the title.**\n\nThe title should just be descriptive.\nIssue numbers belong in the PR body as either `Fixes #XYZ` (if it closes the issue or PR), or something like `Related to #XYZ` (if it's just related).")
}

if regexp.MustCompile(`(?s)<!--.*?-->`).MatchString(pr.GetBody()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this'll get comments inside code blocks, and other stuff too. At the very least we need to check https://github.com/russross/blackfriday/blob/v2.0.1/html.go#L68.

The "more correct" solution is probably to parse the markdown with blackfriday & look for html nodes that are comment nodes, I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for the "more correct" solution

errs = append(errs, "**Your PR has comments in the description. **\n\n Please remove all comments from the description before you submit.")
}

if len(errs) == 0 {
return "Your PR description looks okay!", nil
}
Expand Down