test: enable default-disabled rule tests via per-rule rulesets (#350)#354
Merged
Conversation
Five test classes were gated behind a TODO because their analyzer rules are
declared isEnabledByDefault: false, so the diagnostics never ran in tests
(the in-memory test compilation never applied any ruleset). The tests were
commented out as a result.
RoslynTestKit 1.4.0 now loads a ruleset and applies it to the test
compilation's diagnostic options. This change:
- Bumps ALCops.RoslynTestKit to 1.4.0 across all test projects (also
unifying the pre-existing 1.3.0 / 1.1.1 split between the package and CI
binary references).
- Adds a co-located {Rule}.ruleset.json per affected rule that enables only
that rule at its default severity.
- Rewrites the five test classes to compute the test-case path first, create
the fixture with AnalyzerTestFixtureConfig.RuleSetPath, uncomment the
tests, and remove the TODO.
- Drops the invalid EnumObject cases from ExtensiblePropertyExplicitlySet
(the analyzer never registers for enum objects and no fixtures exist) and
wires RuleSetPath into its HasFix CodeFixTestFixtureConfig.
- Updates ac0013 and testing instruction files accordingly.
Affected rules: AC0013, AC0021, AC0008, PC0006, PC0005.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Enables tests for default-disabled rules using per-rule rulesets.
Moved into
mainfromrelease/v1.0.0(commit2ec84ec, originally PR #350) so it lands without implying a v1.0.0 release.Depends on #351 (RoslynTestKit 1.3.0 bump): the test
.csprojchanges here build on that bump. This PR is therefore based onchore/roslyntestkit-1.3.0. After #351 merges, retarget this PR's base tomain(gh pr edit --base main); GitHub will then show only this PR's diff.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com