Skip to content

Ignore trailing/leading whitespace when validating sarif files#52618

Merged
mmitche merged 1 commit intodotnet:mainfrom
mmitche:ignore-trailing-whitespace
Jan 22, 2026
Merged

Ignore trailing/leading whitespace when validating sarif files#52618
mmitche merged 1 commit intodotnet:mainfrom
mmitche:ignore-trailing-whitespace

Conversation

@mmitche
Copy link
Copy Markdown
Member

@mmitche mmitche commented Jan 21, 2026

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.

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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .editorconfig setting 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

@mmitche
Copy link
Copy Markdown
Member Author

mmitche commented Jan 22, 2026

/ba green

@mmitche mmitche merged commit 239a092 into dotnet:main Jan 22, 2026
30 of 33 checks passed
@mmitche
Copy link
Copy Markdown
Member Author

mmitche commented Jan 22, 2026

/backport to release/10.0.1xx

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.1xx (link to workflow run)

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.

3 participants