Skip to content

Add end line/column and metadata to violations (#68) - #97

Merged
james-d12 merged 1 commit into
mainfrom
feature/violation-spans-metadata-68
Oct 13, 2026
Merged

james-d12 merged 1 commit into
mainfrom
feature/violation-spans-metadata-68

Conversation

@james-d12

Copy link
Copy Markdown
Owner

Summary

  • Violation and AnalyzerViolation gain optional EndLine/EndColumn; Violation gains an optional Metadata dictionary. All new parameters default to null, so existing call sites compile.
  • Roslyn-backed models (TypeModel, MethodModel, PropertyModel, ConstructorModel, FieldModel, CallSiteModel, DiagnosticModel, and the syntax-fact models) populate end positions from GetLineSpan().EndLinePosition, using the same 1-based convention as the start. End column is exclusive, matching SARIF region.endColumn.
  • Analyzers that report from these models pass the end positions through. RuleEvaluator carries them onto Violation.
  • SARIF: Region.EndLine/EndColumn are set only when present. Metadata goes into the result property bag. A violation without an end span still gets a start-only region.
  • JSON v1 contract: endLine, endColumn and metadata are optional additive per-violation properties in ValidationReportV1, the mapper, the schema, and RESULT_CONTRACT.md. JsonViolationReporter is unchanged.
  • Tests cover the Roslyn extractor end positions, SARIF end/metadata mapping and the start-only case, JSON presence and absence, the mapper, and schema conformance.
  • IMPLEMENTATION_STATUS.md has a short note.

No built-in rule populates Metadata yet.

Closes #68

🤖 Generated with Claude Code

Violation and AnalyzerViolation gain optional EndLine/EndColumn, and
Violation gains an optional Metadata bag. Roslyn-backed models and the
analyzers that report from them thread end positions through from
GetLineSpan().EndLinePosition (1-based, exclusive end column).

- SARIF: Region.EndLine/EndColumn when present; metadata goes into the
  result property bag.
- JSON v1 contract: endLine, endColumn and metadata are optional
  additive per-violation properties; schema and RESULT_CONTRACT.md
  updated.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@james-d12
james-d12 merged commit 6b35770 into main Oct 13, 2026
5 checks passed
@james-d12
james-d12 deleted the feature/violation-spans-metadata-68 branch October 13, 2026 19:49
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.

End line/column and a metadata bag on violations

1 participant