Skip to content

Add SignCheck exclusion pattern exceptions - #17334

Merged
akoeplinger merged 2 commits into
dotnet:mainfrom
akoeplinger:copilot/add-signcheck-exclusion-entry
Aug 14, 2026
Merged

akoeplinger merged 2 commits into
dotnet:mainfrom
akoeplinger:copilot/add-signcheck-exclusion-entry

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • support !-prefixed file patterns as exceptions within a SignCheck exclusion entry
  • require an entry with exceptions to contain at least one positive file pattern
  • report the exclusions file path, line number, and content for malformed entries
  • document the syntax and add focused unit coverage

Example:

*.js|!signed.js;;DO-NOT-SIGN

This excludes all JavaScript files except signed.js. Exception order within the entry does not affect the result.

Contributes to dotnet/dotnet#7943

Testing

  • ./.dotnet/dotnet test src/Microsoft.DotNet.SignCheckLibrary.Tests/Microsoft.DotNet.SignCheckLibrary.Tests.csproj --configuration Release --no-restore --nologo (8 passed)

Allow a file pattern prefixed with ! to veto positive patterns in the same exclusion entry. Add parsing diagnostics, focused tests, and documentation for the new syntax.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends SignCheck’s exclusions syntax to support !-prefixed exception patterns within a single exclusion entry (e.g., exclude *.js except signed.js), adds validation for malformed exception entries, improves diagnostics for invalid exclusions-file lines, and documents the new syntax with focused unit tests.

Changes:

  • Add parsing and validation of !-prefixed file pattern exceptions in Exclusion.
  • Update exclusion matching logic to honor exception patterns (exceptions override positives).
  • Add documentation and unit tests (including a new test project added to the solution).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Microsoft.DotNet.SignCheckLibrary/Verification/Exclusions.cs Wrap invalid exclusion-line parsing with richer path/line/content diagnostics; apply exception-aware matching.
src/Microsoft.DotNet.SignCheckLibrary/Verification/Exclusion.cs Parse and validate exception patterns; expose exception APIs used by matching logic.
src/Microsoft.DotNet.SignCheckLibrary/README.md Document the exclusions file syntax and exception semantics.
src/Microsoft.DotNet.SignCheckLibrary.Tests/Microsoft.DotNet.SignCheckLibrary.Tests.csproj Introduce a new test project for SignCheckLibrary exclusions behavior.
src/Microsoft.DotNet.SignCheckLibrary.Tests/ExclusionsTests.cs Add unit coverage for exception precedence, parent scoping, and invalid-entry diagnostics.
Arcade.slnx Add the new SignCheckLibrary test project to the solution.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Avoid allocating copies of parsed patterns during matching and correct the reviewed documentation issues.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings August 13, 2026 20:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/Microsoft.DotNet.SignCheckLibrary/Verification/Exclusion.cs:80

  • The FilePatterns XML doc no longer reflects the property’s new semantics: it now returns only the positive patterns (excluding any !-prefixed exceptions). Clarifying this avoids confusion for API consumers and keeps the docs consistent with FilePatternExceptions.
        /// <summary>
        /// Returns an array of file patterns. Each file pattern is separated by '|'.
        /// </summary>
        public string[] FilePatterns

@akoeplinger
akoeplinger merged commit 09a0bcf into dotnet:main Aug 14, 2026
10 of 12 checks passed
@akoeplinger
akoeplinger deleted the copilot/add-signcheck-exclusion-entry branch August 14, 2026 07:45
@akoeplinger

Copy link
Copy Markdown
Member Author

/backport to release/10.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0 (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