Repository navigation
Add SignCheck exclusion pattern exceptions - #17334
Conversation
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]>
There was a problem hiding this comment.
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 inExclusion. - 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]>
There was a problem hiding this comment.
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
FilePatternsXML 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 withFilePatternExceptions.
/// <summary>
/// Returns an array of file patterns. Each file pattern is separated by '|'.
/// </summary>
public string[] FilePatterns
|
/backport to release/10.0 |
|
Started backporting to |
Summary
!-prefixed file patterns as exceptions within a SignCheck exclusion entryExample:
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)