Enable default-disabled rule tests via per-rule rulesets#350
Merged
Arthurvdv merged 1 commit intoJun 18, 2026
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>
Arthurvdv
added a commit
that referenced
this pull request
Jun 18, 2026
test: enable default-disabled rule tests via per-rule rulesets (#350)
MODUSCarstenScholling
pushed a commit
to MODUSCarstenScholling/ALCops-Analyzers
that referenced
this pull request
Jun 19, 2026
…s#350) 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.
Summary
Five test classes were gated behind a TODO (
Expose .WithRuleSetPath in RoslynTestKit, so we can enable/disable diagnostics in tests). Their analyzer rules are declaredisEnabledByDefault: false, so the diagnostics never ran in the in-memory test compilation and the tests were commented out.RoslynTestKit #20 (published as 1.4.0) makes
RuleSetPathactually load a ruleset and apply it to the test compilation's diagnostic options. This PR consumes that and re-enables the tests.Changes
ALCops.RoslynTestKitto 1.4.0 across all test projects (also unifying the pre-existing1.3.0/1.1.1split between the package reference and the CI binary reference).{Rule}.ruleset.jsonper affected rule that enables only that rule at its default severity.AnalyzerTestFixtureConfig.RuleSetPath, uncomment the tests, remove the TODO.ExtensiblePropertyExplicitlySet: drop the invalidEnumObjectcases (the analyzer never registers for enum objects and no fixtures exist) and wireRuleSetPathinto itsHasFixCodeFixTestFixtureConfig.ac0013-field-groups-requiredandtestinginstruction files.Affected rules: AC0013, AC0021, AC0008, PC0006, PC0005.
Verification (local, net10.0)
All test projects green against the official
1.4.0:Notes
1.4.0being available on NuGet.org (published).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com