Skip to content

Enable default-disabled rule tests via per-rule rulesets#350

Merged
Arthurvdv merged 1 commit into
release/v1.0.0from
feat/enable-default-disabled-rule-tests
Jun 18, 2026
Merged

Enable default-disabled rule tests via per-rule rulesets#350
Arthurvdv merged 1 commit into
release/v1.0.0from
feat/enable-default-disabled-rule-tests

Conversation

@Arthurvdv

Copy link
Copy Markdown
Member

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 declared isEnabledByDefault: 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 RuleSetPath actually load a ruleset and apply it to the test compilation's diagnostic options. This PR consumes that and re-enables the tests.

Changes

  • Bump 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 reference and the CI binary reference).
  • Add a co-located {Rule}.ruleset.json per affected rule that enables only that rule at its default severity.
  • Rewrite the five test classes: compute the test-case path first, create the fixture with AnalyzerTestFixtureConfig.RuleSetPath, uncomment the tests, remove the TODO.
  • ExtensiblePropertyExplicitlySet: drop the invalid EnumObject cases (the analyzer never registers for enum objects and no fixtures exist) and wire RuleSetPath into its HasFix CodeFixTestFixtureConfig.
  • Update ac0013-field-groups-required and testing instruction files.

Affected rules: AC0013, AC0021, AC0008, PC0006, PC0005.

Verification (local, net10.0)

All test projects green against the official 1.4.0:

Project Result
ApplicationCop.Test 298 passed
PlatformCop.Test 456 passed
DocumentationCop.Test 37 passed
FormattingCop.Test 83 passed
LinterCop.Test 247 passed
TestAutomationCop.Test 5 passed

Notes

  • Depends on RoslynTestKit 1.4.0 being available on NuGet.org (published).
  • The temporary local NuGet feed used during development has been removed.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

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 Arthurvdv merged commit 2ec84ec into release/v1.0.0 Jun 18, 2026
48 checks passed
@Arthurvdv Arthurvdv deleted the feat/enable-default-disabled-rule-tests branch June 18, 2026 14:17
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>
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.

1 participant