Skip to content

[64.3] CJ0050: suggest named extension property when common .Where() pattern detected#131

Merged
kommundsen merged 1 commit intomainfrom
feat/64-126-cj0050-extension-property-suggestion-analyzer
Apr 10, 2026
Merged

[64.3] CJ0050: suggest named extension property when common .Where() pattern detected#131
kommundsen merged 1 commit intomainfrom
feat/64-126-cj0050-extension-property-suggestion-analyzer

Conversation

@kommundsen
Copy link
Copy Markdown
Owner

Description

Adds CJ0050Analyzer (Info severity) that detects five blessed .Where() predicate patterns on Strategy<T> and suggests the named extension property equivalent (Positive, Negative, NonZero, NonEmpty). A companion CJ0050CodeFix replaces the .Where(lambda) call with the named property in one action.

Pattern matching is structural (parameter-name-agnostic). A syntactic fallback handles test harnesses where the semantic model cannot resolve Strategy<T> due to namespace conflicts. The diagnostic does not fire on unrelated IEnumerable<T>.Where() calls.

Type of change

  • New feature / strategy

Checklist

  • dotnet test src/ passes
  • New behavior is covered by tests (TDD: Red → Green → Refactor)
  • Follows .editorconfig code style

Closes #126
Part of #64

…() patterns

- Detects 5 blessed predicates on Strategy<T>: x > 0, x < 0, x != 0,
  x.Length > 0, x.Count > 0 — suggests Positive, Negative, NonZero, NonEmpty
- Code fix in CJ0050CodeFix replaces the .Where(lambda) call with the named property
- Syntactic fallback for test harnesses where semantic model can't resolve Strategy<T>
- Diagnostic is Info severity; does not fire on unrelated IEnumerable<T>.Where()
@kommundsen kommundsen merged commit 6dd0a51 into main Apr 10, 2026
1 check passed
@kommundsen kommundsen deleted the feat/64-126-cj0050-extension-property-suggestion-analyzer branch April 10, 2026 21:05
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.

[64.3] CJ0050: suggest named extension property when common .Where() pattern detected

1 participant