Skip to content

feat(analyzers): add three performance rules and extend two more - #182

Merged
e128 merged 1 commit into
mainfrom
feature/analyzer-roadmap-active
Nov 18, 2026
Merged

e128 merged 1 commit into
mainfrom
feature/analyzer-roadmap-active

Conversation

@e128

@e128 e128 commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Executive Summary

The roadmap's active section held five analyzer shapes. Three ship as new rules and two extend shipped rules.

  • E128229 reports the inline middleware overload that takes a Func<Task> next delegate. The fix switches to RequestDelegate and passes the context.
  • E128230 reports UseStaticFiles when the compilation also declares MapStaticAssets. No fix, because the call moves into the endpoint mapping section.
  • E128231 reports a foreach over string.Split with a char or constant-string separator. The fix enumerates source.AsSpan().Split(separator) when every read of the part accepts a span.
  • E128135 also reports a min or max reduction loop. The accumulator must start at the neutral value, so the vector call computes the same result.
  • E128084 also reports for (int i = 0; i < list.Count; i++) when the body only reads list[i] and never mutates the list.

The package version moves to 3.3.0.

Code Changes

  • src/E128.Analyzers/Performance/: three analyzers, the SpanOperation type, the E128135 and E128084 extensions, and the shared IndexedForLoop bound-member overload.
  • src/E128.Analyzers.CodeFixers/Performance/: two new fix providers and the extended E128135 and E128084 providers.
  • src/E128.Analyzers/AnalyzerReleases.Shipped.md: a Release 3.3.0 section with three new rules and two changed rules.
  • src/E128.Analyzers/README.md: rule rows and detail sections.
  • Tests: analyzer, code-fix, and matcher coverage for each shape.
  • lode/ and plans/roadmap.md: the register, catalog, rule details, map, and roadmap now match the shipped state.

One roadmap sample was wrong. It rewrote int.Parse(part) to int.Parse(span), but the narrowest span overload also takes an IFormatProvider. E128231 reports that shape without a fix, and the docs record why.

Tests and Tooling

scripts/check.sh --all passes shell lint, the analyzer release check, format, build, and the full test suite. The README table diff and README audit report no drift. The format pass skipped the JetBrains cleanup because the tool is not installed.

Review Guide

Read the three analyzers first, then the four fix providers. The tests named after each rule show the reported and suppressed shapes. ListIndexerLoopMatcherTests exercises the E128084 matcher against a real compilation.

Rollback

Revert the commit. The change adds analyzers and docs and touches no persisted data.

Add E128229 for the Func<Task> middleware next delegate, E128230 for
UseStaticFiles, and E128231 for a split result that only a foreach
enumerates. Extend E128135 with min and max reduction loops and E128084
with a List indexer loop. Ship release 3.3.0 and update the README, the
candidate register, and the roadmap.
@e128
e128 merged commit 2071c80 into main Nov 18, 2026
2 checks passed
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