Skip to content

feat: add excludePatterns parameter to violation reporting tools#25

Merged
Karnaukhov-kh merged 5 commits intopush-based:mainfrom
AbdulRehaman08:feature/exclude-patterns-violation-reports
Mar 17, 2026
Merged

feat: add excludePatterns parameter to violation reporting tools#25
Karnaukhov-kh merged 5 commits intopush-based:mainfrom
AbdulRehaman08:feature/exclude-patterns-violation-reports

Conversation

@AbdulRehaman08
Copy link
Copy Markdown

@AbdulRehaman08 AbdulRehaman08 commented Mar 11, 2026

Add optional excludePatterns parameter to report-violations and report-all-violations tools, enabling users to exclude files/directories from violation scans using glob patterns.

Features:

  • Supports single string or array of glob patterns
  • Standard glob syntax: *, **, ?
  • Custom glob-to-regex converter (no external dependencies)
  • Pre-compiled regexes per run for performance on large result sets
  • Reuses existing normalizeFilePath for consistent path handling
  • Post-processing filter approach (filters after plugin execution)
  • Score recalculation — audits with all issues excluded get score: 1
  • Cross-platform path normalization
  • Fail-fast validation with clear error messages

Changes:

  • Add excludePatterns to schema definitions (schema-helpers.ts)
  • Update type interfaces across all layers
  • Implement pattern matching in coverage-analyzer.ts using normalizeFilePath from formatters.ts
  • Pass excludePatterns through base-analyzer.ts via spread ({ ...options, cwd, ... })
  • Update both tool handlers to accept and forward parameter

Examples:

  • Single: excludePatterns: "node_modules/**"
  • Multiple: excludePatterns: ["node_modules/**", "**/dist/**", "**/*.spec.ts"]

Build: Passes successfully without errors
Backward Compatible: Optional parameter, no breaking changes

Add optional excludePatterns parameter to report-violations and report-all-violations tools, enabling users to exclude files/directories from violation scans using glob patterns.

Features:
- Supports single string or array of glob patterns
- Standard glob syntax: *, **, ?, character classes
- Custom glob-to-regex converter (no external dependencies)
- Post-processing filter approach (filters after plugin execution)
- Cross-platform path normalization
- Fail-fast validation with clear error messages

Changes:
- Add excludePatterns to schema definitions (schema-helpers.ts)
- Update type interfaces across all layers
- Implement inline pattern matching in coverage-analyzer.ts
- Pass excludePatterns through base-analyzer.ts
- Update both tool handlers to accept and forward parameter

Examples:
- Single: excludePatterns: 'node_modules/**'
- Multiple: excludePatterns: ['node_modules/**', '**/dist/**', '**/*.spec.ts']

Fixes path handling bug: Use issue.source.file directly (already relative) instead of calling path.relative()

Build: Passes successfully without errors
Backward Compatible: Optional parameter, no breaking changes
@Karnaukhov-kh
Copy link
Copy Markdown
Member

Hi @AbdulRehaman08, thank you for this PR. When you have time, please check pipeline failure (should be simple format write run). When you're ready, put it as "Ready for review".

@AbdulRehaman08 AbdulRehaman08 marked this pull request as ready for review March 14, 2026 06:56
@AbdulRehaman08 AbdulRehaman08 marked this pull request as draft March 14, 2026 07:27
@AbdulRehaman08 AbdulRehaman08 marked this pull request as ready for review March 14, 2026 09:21
Copy link
Copy Markdown

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

Adds an optional excludePatterns parameter to the DS violation reporting tools so users can exclude matching files/directories from violation results using glob-like patterns.

Changes:

  • Extends schemas and option/type interfaces to accept excludePatterns as string | string[].
  • Threads excludePatterns through analyzers and tool handlers.
  • Implements post-processing filtering of plugin issues in coverage-analyzer.ts based on glob matching.

Reviewed changes

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

Show a summary per file
File Description
packages/angular-mcp-server/src/lib/tools/ds/shared/violation-analysis/types.ts Adds excludePatterns to shared analyzer params/options types.
packages/angular-mcp-server/src/lib/tools/ds/shared/violation-analysis/coverage-analyzer.ts Adds glob-to-regex conversion + issue filtering to exclude matched paths.
packages/angular-mcp-server/src/lib/tools/ds/shared/violation-analysis/base-analyzer.ts Passes excludePatterns through to coverage analysis.
packages/angular-mcp-server/src/lib/tools/ds/shared/models/schema-helpers.ts Adds excludePatterns schema property and injects it into common schemas.
packages/angular-mcp-server/src/lib/tools/ds/report-violations/report-violations.tool.ts Forwards excludePatterns into the base analyzer call.
packages/angular-mcp-server/src/lib/tools/ds/report-violations/report-all-violations.tool.ts Forwards excludePatterns into project coverage analysis call.
packages/angular-mcp-server/src/lib/tools/ds/report-violations/models/types.ts Adds excludePatterns to tool option types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@Karnaukhov-kh Karnaukhov-kh merged commit 96a8f1c into push-based:main Mar 17, 2026
1 check passed
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