Skip to content

test: cover directive.specify-disable-reason - #1741

Merged
alexandear merged 3 commits into
revive-lint:masterfrom
alexandear:test/specify-disable-reason
Jun 8, 2026
Merged

alexandear merged 3 commits into
revive-lint:masterfrom
alexandear:test/specify-disable-reason

Conversation

@alexandear

@alexandear alexandear commented Jun 3, 2026 •

Copy link
Copy Markdown
Member

Improve tests for the directive.specify-disable-reason, added in #193.

For #1739

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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, and specify-disable-reason scenarios.
  • Add a dedicated revive_disable_directives test file and remove the older disable_annotations test file.
  • Refactor the test harness to accept lint.Config (instead of only a map[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.

Comment thread test/utils_test.go Resolved
@alexandear
alexandear merged commit a3958d9 into revive-lint:master Jun 8, 2026
10 checks passed
@alexandear
alexandear deleted the test/specify-disable-reason branch June 8, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants