Repository navigation
test: cover directive.specify-disable-reason - #1741
Merged
alexandear merged 3 commits intoJun 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the test suite around //revive:disable* directive handling, including coverage for the directive.specify-disable-reason behavior (enabled via lint.Config.Directives). It also refactors test helpers to allow passing a full lint.Config through the fixture-driven test harness.
Changes:
- Add new fixtures under
testdata/covering disable/enable, disable-line, disable-next-line, andspecify-disable-reasonscenarios. - Add a dedicated
revive_disable_directivestest file and remove the olderdisable_annotationstest file. - Refactor the test harness to accept
lint.Config(instead of only amap[string]lint.RuleConfig) and update callers accordingly.
Reviewed changes
Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| testdata/revive_disable_directives.go | New fixture validating baseline disable/enable directive behavior for the exported rule. |
| testdata/revive_disable_directives_specify_disable_reason.go | New fixture asserting failures when disable directives lack a reason under specify-disable-reason. |
| testdata/revive_disable_directives_next_line.go | New fixture validating disable-next-line placement (including before package decl). |
| testdata/revive_disable_directives_modified.go | New fixture covering mixed directive forms and inline/invalid directive-like strings. |
| test/utils_test.go | Refactors test harness to pass lint.Config through and introduces testRuleWithLintConfig. |
| test/revive_disable_directives_test.go | New tests exercising the new fixtures and specify-disable-reason directive configuration. |
| test/golint_test.go | Updates to new assertFailures signature using lint.Config. |
| test/disable_annotations_test.go | Removed in favor of the new directive-focused test suite. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve tests for the
directive.specify-disable-reason, added in #193.For #1739