Ignore trailing/leading whitespace when validating sarif files#52618
Merged
mmitche merged 1 commit intodotnet:mainfrom Jan 22, 2026
Merged
Ignore trailing/leading whitespace when validating sarif files#52618mmitche merged 1 commit intodotnet:mainfrom
mmitche merged 1 commit intodotnet:mainfrom
Conversation
Some editor configs will automatically insert a newline on save. The sarif generator does not insert such a newline. This a meaningless difference in comparison, so ignore it to avoid failures in PR.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses validation failures caused by editor configurations automatically inserting final newlines in generated files. The generator doesn't add such newlines, creating meaningless differences that cause validation to fail.
Changes:
- Modified the validation logic to use trimmed comparison instead of exact string matching
- Added
.editorconfigsetting to disable automatic final newline insertion for SARIF files - Cleaned up trailing whitespace in XML comments within the code generator
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .editorconfig | Added insert_final_newline = false for *.sarif files to prevent editors from automatically adding final newlines |
| src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs | Updated validation to compare trimmed strings and removed trailing whitespace from XML comments |
src/Microsoft.CodeAnalysis.NetAnalyzers/tools/GenerateDocumentationAndConfigFiles/Program.cs
Show resolved
Hide resolved
3 tasks
ViktorHofer
approved these changes
Jan 22, 2026
Member
Author
|
/ba green |
Member
Author
|
/backport to release/10.0.1xx |
Contributor
|
Started backporting to |
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.
Some editor configs will automatically insert a newline on save. The sarif generator does not insert such a newline. This a meaningless difference in comparison, so ignore it to avoid failures in PR.