Skip to content

Add possibility to suppress warnings in GitRepository issue provider#1172

Merged
pascalberger merged 10 commits intodevelopfrom
copilot/fix-482
Aug 2, 2025
Merged

Add possibility to suppress warnings in GitRepository issue provider#1172
pascalberger merged 10 commits intodevelopfrom
copilot/fix-482

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 1, 2025

This PR adds comprehensive warning suppression functionality to the GitRepository issue provider, allowing users to exclude specific files from repository analysis using glob patterns.

Key Features

🎯 Flexible Exclusion Options

  • Global exclusions: FilesToExclude affects all repository checks
  • Rule-specific exclusions: Separate control for LFS and path length checks
  • Hierarchical filtering: Global exclusions take precedence over specific ones

🔍 Powerful Pattern Matching

The FilePatternMatcher utility supports full glob-style patterns:

  • *.tmp - matches all temporary files
  • **/*.dll - matches DLL files in any subdirectory
  • temp/** - matches all files in temp directories
  • file?.txt - single character wildcards
  • Proper escaping of regex special characters

💻 Usage Examples

var settings = new GitRepositoryIssuesSettings
{
    CheckBinaryFilesTrackedByLfs = true,
    CheckFilesPathLength = true,
    MaxFilePathLength = 260
};

// Exclude build artifacts from all checks
settings.FilesToExclude.Add("*.tmp");
settings.FilesToExclude.Add("temp/**");

// Exclude binaries from LFS checks only
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("*.dll");
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("bin/**");

// Exclude generated code from path length checks
settings.FilesToExcludeFromFilePathLengthCheck.Add("generated/**");

Implementation Details

  • Backward compatible: All existing functionality remains unchanged
  • Well-tested: Comprehensive test coverage for pattern matching and exclusion logic
  • Documented: Restructured examples following project conventions with separate Examples section
  • Performant: Efficient filtering integrated into existing check methods
  • Optimized: Uses custom FilePatternMatcher designed specifically for this use case after analyzing Cake.Core.IO.Globber feasibility

This addresses the common need to suppress warnings for build artifacts, temporary files, and generated code while maintaining fine-grained control over which checks are affected.

Fixes #482.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Add possibility to suppress warnings Add possibility to suppress warnings in GitRepository issue provider Aug 1, 2025
Copilot AI requested a review from pascalberger August 1, 2025 12:37
Copilot AI and others added 4 commits August 1, 2025 16:53
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
@pascalberger
Copy link
Copy Markdown
Member

https://gh.io/copilot-coding-agent-docs Your environment has been updated that you can build locally and run the build script to ensure CI builds are working and you can find detailed contribution instructions in copilot-instructions.md.

Ensure build script runs successfully.

Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 2, 2025

https://gh.io/copilot-coding-agent-docs Your environment has been updated that you can build locally and run the build script to ensure CI builds are working and you can find detailed contribution ins...

Build script is now running successfully! Fixed the test issues that were preventing the build from passing. All tests are now passing with proper exclusion logic testing and correct FilePatternMatcher escape character handling. Commit: 7426188

@pascalberger
Copy link
Copy Markdown
Member

@copilot Analyze if we can use Cake.Core.IO.Globber (https://github.com/cake-build/cake/blob/6476d1703101e28aa3883ca3867c8de44afe8e0e/src/Cake.Core/IO/Globber.cs) instead of implementing our own FilePatternMatcher.

Also move the additional example in the documentation to a separate page in an Examples section (like it is done for Cake.Issues.MsBuild` issue provider).

Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Aug 2, 2025

@copilot Analyze if we can use Cake.Core.IO.Globber (https://github.com/cake-build/cake/blob/6476d1703101e28aa3883ca3867c8de44afe8e0e/src/Cake.Core/IO/Globber.cs) instead of implementing our own FileP...

I've completed both requested tasks:

Documentation Restructuring:
Moved the exclusion examples to a separate Examples section following the MsBuild provider pattern:

  • Created examples/ directory with organized structure
  • examples/index.md - Overview with navigation links
  • examples/basic-usage.md - Basic repository analysis
  • examples/excluding-files.md - Pattern-based exclusions with reference table

Globber Analysis:
Added IGlobber integration and analyzed feasibility:

  • Successfully integrated IGlobber into GitRepositoryIssuesProvider constructor
  • Updated aliases to pass context.Globber

Key Finding: Cake.Core.IO.Globber is designed for file system enumeration (globber.Match(pattern) returns actual files), not pattern matching against arbitrary paths. Our use case requires checking if specific file paths match patterns without file system access, which Globber doesn't directly support.

Recommendation: Keep the current FilePatternMatcher implementation as it efficiently handles our exact use case. The Globber would require significant workarounds and file system access for functionality we already have working well.

Commit: 5515d3f

Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
@pascalberger pascalberger marked this pull request as ready for review August 2, 2025 13:26
@pascalberger pascalberger requested a review from a team as a code owner August 2, 2025 13:26
@pascalberger pascalberger enabled auto-merge (squash) August 2, 2025 13:29
@pascalberger pascalberger disabled auto-merge August 2, 2025 13:42
@pascalberger pascalberger merged commit 773a045 into develop Aug 2, 2025
96 checks passed
@pascalberger pascalberger deleted the copilot/fix-482 branch August 2, 2025 13:43
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.

Add possibility to suppress warnings

2 participants