-
Notifications
You must be signed in to change notification settings - Fork 424
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 a test for WARNINGS.md #660
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
LGTM
warn/documentation_test.go
Outdated
for _, warning := range AllWarnings { | ||
link := fmt.Sprintf(" * [%s](#%s)", warning, warning) | ||
if !strings.Contains(contents, link) { | ||
t.Errorf("No link found for the warning %q in WARNINGS.md, is it documented?", warning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. the error message should include the pattern you match (link
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
warn/documentation_test.go
Outdated
|
||
anchor := fmt.Sprintf(`<a name="%s"></a>`, warning) | ||
if !strings.Contains(contents, anchor) { | ||
t.Errorf("No anchor found for the warning %q in WARNINGS.md, is it documented?", warning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, include anchor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
All warnings contain a link to
https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#<category_name>
, the new test ensures that all registered warnings are documented in the file (at least that there's a link in the header and an anchor for each warning).