Skip to content

Add missing code fixers for MA0088-MA0137#1072

Merged
meziantou merged 6 commits intomainfrom
add-missing-code-fixers-ma0088-0137
Mar 30, 2026
Merged

Add missing code fixers for MA0088-MA0137#1072
meziantou merged 6 commits intomainfrom
add-missing-code-fixers-ma0088-0137

Conversation

@meziantou
Copy link
Copy Markdown
Owner

Why

Several analyzer rules had diagnostics but no corresponding code fixes, which made remediation slower and less discoverable for users relying on "Fix all" workflows.

What changed

This PR adds/extends code-fix support for the requested rules:

  • Added new fixers for:
    • MA0088 (OptionalParametersAttributeFixer)
    • MA0090 (RemoveEmptyBlockFixer)
    • MA0099 (DoNotUseZeroToInitializeAnEnumValueFixer)
    • MA0105 / MA0106 (AvoidClosureWhenUsingConcurrentDictionaryFixer)
    • MA0127 (UseStringEqualsInsteadOfIsPatternFixer)
    • MA0129 (TaskInUsingFixer)
    • MA0131 (ThrowIfNullWithNonNullableInstanceFixer)
  • Extended existing OptimizeLinqUsageFixer to support MA0112 (UseCountInsteadOfAny).
  • MA0137 already had an existing fixer (MethodsReturningAnAwaitableTypeMustHaveTheAsyncSuffixFixer), and coverage was validated.

Tests and validation

  • Updated existing rule test files to register the new fixers and added focused code-fix assertions.
  • Verification run:
    • dotnet build -v:q
    • Targeted rule test suite for the affected analyzers ✅ (all passing)

Notes

  • dotnet run --project src/DocumentationGenerator fails in this worktree environment with Cannot find the current git folder (worktree .git file vs directory expectation), so documentation regeneration could not be completed here.

meziantou and others added 6 commits March 30, 2026 13:50
Implement missing code fix providers and tests for MA0088, MA0090, MA0099, MA0105, MA0106, MA0112, MA0127, MA0129, and MA0131. MA0137 already had an existing fixer and is covered by targeted tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address CA1859, IDE0060, and IDE1006 violations in new code-fixer implementation so publish/build_and_test jobs compile cleanly across matrix versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Synchronize rule docs and docs index with newly added code fix providers so check_documentation passes in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update DocumentationGenerator to use FullPath.TryFindGitRepositoryRoot and upgrade Meziantou.Framework.FullPath to 1.1.18. This supports worktree repositories and allows documentation generation to run without custom git-folder logic.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add MA0099 enum-zero fallback cast fix/test, tighten MA0129 task-disposable fix applicability and tests, and update MA0127 to offer Ordinal + OrdinalIgnoreCase fixes while making the rule hidden and enabled by default. Regenerate docs and default editorconfig.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Frulfump
Copy link
Copy Markdown

Frulfump commented Mar 31, 2026

Notes
dotnet run --project src/DocumentationGenerator fails in this worktree environment with Cannot find the current git folder (worktree .git file vs directory expectation), so documentation regeneration could not be completed here.

From the description, I don't see a docs update after this?
(And why are all PRs in this repo referenced by Dependabot it makes it so you have to scroll so much to look for comments and the PR itself loads so slowly, is there anything you can do from your side?)

IhateTrains added a commit to ParadoxGameConverters/ImperatorToCK3 that referenced this pull request Apr 3, 2026
Updated
[Meziantou.Analyzer](https://github.com/meziantou/Meziantou.Analyzer)
from 3.0.29 to 3.0.44.

<details>
<summary>Release notes</summary>

_Sourced from [Meziantou.Analyzer's
releases](https://github.com/meziantou/Meziantou.Analyzer/releases)._

## 3.0.44

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.44>

## What's Changed
* MA0011: suppress diagnostic when all AppendFormat template arguments
are culture-insensitive by @​Copilot in
meziantou/Meziantou.Analyzer#1085


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.43...3.0.44

## 3.0.43

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.43>

## What's Changed
* Fix expression parenthesis in code fixers by @​meziantou in
meziantou/Meziantou.Analyzer#1083


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.42...3.0.43

## 3.0.42

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.42>

## What's Changed
* Cache IsAwaitable result for the no-SyntaxNode overload by @​meziantou
in meziantou/Meziantou.Analyzer#1082


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.41...3.0.42

## 3.0.41

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.41>

## What's Changed
* Improve MA0042 async overload matching coverage by @​meziantou in
meziantou/Meziantou.Analyzer#1065


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.40...3.0.41

## 3.0.40

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.40>

## What's Changed
* Add MA0191: Detect null! and default! usage by @​Copilot in
meziantou/Meziantou.Analyzer#1081


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.39...3.0.40

## 3.0.39

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.39>

## What's Changed
* Add code fixes for MA0094-MA0097 by @​meziantou in
meziantou/Meziantou.Analyzer#1078


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.38...3.0.39

## 3.0.38

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.38>

## What's Changed
* Fix typos and grammar across all 188 rule documentation files by
@​Copilot in meziantou/Meziantou.Analyzer#1076
* Add code fixers for MA0118, MA0161, and MA0186 by @​meziantou in
meziantou/Meziantou.Analyzer#1079
* Validate fix conditions in RegisterCodeFixesAsync before registering
code fixes by @​Copilot in
meziantou/Meziantou.Analyzer#1077


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.37...3.0.38

## 3.0.37

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.37>

## What's Changed
* docs: require updating rule docs when rules change by @​meziantou in
meziantou/Meziantou.Analyzer#1075
* Add code fixers for MA0138/44/46/52/56/57/58/60/69/73 by @​meziantou
in meziantou/Meziantou.Analyzer#1074


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.36...3.0.37

## 3.0.36

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.36>

## What's Changed
* Add missing code fixers for 10 analyzer rules by @​meziantou in
meziantou/Meziantou.Analyzer#1073


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.35...3.0.36

## 3.0.35

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.35>

## What's Changed
* Add missing code fixers for MA0088-MA0137 by @​meziantou in
meziantou/Meziantou.Analyzer#1072


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.34...3.0.35

## 3.0.34

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.34>

## What's Changed
* Add code fixer for MA0174 (Record should use explicit 'class' keyword)
by @​Copilot in
meziantou/Meziantou.Analyzer#1070


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.33...3.0.34

## 3.0.33

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.33>

## What's Changed
* Add code fixer for MA0173 (Use LazyInitializer.EnsureInitialized) by
@​Copilot in meziantou/Meziantou.Analyzer#1071


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.32...3.0.33

## 3.0.32

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.32>

## What's Changed
* Add code fixer for MA0175 (Remove explicit `class` keyword from record
declarations) by @​Copilot in
meziantou/Meziantou.Analyzer#1069


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.31...3.0.32

## 3.0.31

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.31>

## What's Changed
* Add code fixer for MA0137 and MA0138 (async suffix naming) by
@​Copilot in meziantou/Meziantou.Analyzer#1068


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.30...3.0.31

## 3.0.30

NuGet package:
<https://www.nuget.org/packages/Meziantou.Analyzer/3.0.30>

## What's Changed
* MA0137: Add `exclude_test_methods` configuration option by @​Copilot
in meziantou/Meziantou.Analyzer#1067


**Full Changelog**:
meziantou/Meziantou.Analyzer@3.0.29...3.0.30

Commits viewable in [compare
view](meziantou/Meziantou.Analyzer@3.0.29...3.0.44).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Meziantou.Analyzer&package-manager=nuget&previous-version=3.0.29&new-version=3.0.44)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
This was referenced Apr 3, 2026
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