Add analyzer rules for ConceptAs conventions (CRARCH0027, CRARCH0028)#10
Draft
Copilot wants to merge 3 commits into
Draft
Add analyzer rules for ConceptAs conventions (CRARCH0027, CRARCH0028)#10Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…RCH0029) - CRARCH0027: ConceptAs must have a static readonly NotSet sentinel - CRARCH0028: Guid-backed identity concept must have a static New() factory - CRARCH0029: Avoid using primitive types - wrap in ConceptAs<> (initial implementation)
- CRARCH0027 and CRARCH0028 fully implemented with passing tests - CRARCH0029 infrastructure in place but commented out pending refinement - All 108 analyzer tests passing
Copilot
AI
changed the title
[WIP] Add static code analysis rules for ConceptAs
Add analyzer rules for ConceptAs conventions (CRARCH0027, CRARCH0028)
Jun 16, 2026
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.
Adds two Roslyn analyzers enforcing ConceptAs domain value conventions with actionable diagnostic messages.
Rules
CRARCH0027: ConceptAs must have NotSet sentinel
ConceptAs<T>without a static readonly sentinel fieldNotSet,Empty,Null, orNoneas valid namesCRARCH0028: Guid-backed concepts must have New() factory
ConceptAs<Guid>records without a staticNew()methodCRARCH0029: Reserved
Example
Before:
After:
Implementation
ConceptAsMustHaveNotSetSentinelRule.cs- checks for sentinel field by nameGuidConceptMustHaveNewFactoryRule.cs- checks Guid concepts for New() methodNamedTypeAnalyzersymbol analysis pipeline