Skip to content

fix: extend default ignore patterns and fix nested path matching#92

Open
E-ChintanGohil wants to merge 1 commit intotirth8205:mainfrom
E-ChintanGohil:feat/extend-default-ignore-patterns
Open

fix: extend default ignore patterns and fix nested path matching#92
E-ChintanGohil wants to merge 1 commit intotirth8205:mainfrom
E-ChintanGohil:feat/extend-default-ignore-patterns

Conversation

@E-ChintanGohil
Copy link
Copy Markdown

Summary

  • Fix _should_ignore to handle nested dependency directories (e.g., packages/app/node_modules/) by checking path segments, not just prefix matching
  • Extend DEFAULT_IGNORE_PATTERNS with common framework patterns: PHP/Laravel (vendor/, storage/), Ruby/Rails, Java/Gradle, .NET, Dart/Flutter, and general (coverage/, .cache/, tmp/)

Closes #91

Changes

  • code_review_graph/incremental.py: Updated _should_ignore with PurePosixPath.parts segment matching + added 15 new default patterns
  • tests/test_incremental.py: Added test_should_ignore_nested_paths and test_should_ignore_framework_patterns

Test plan

  • All existing tests pass
  • New tests cover nested node_modules, vendor, storage paths
  • New tests verify framework-specific patterns (Laravel, .NET, Dart, Gradle)
  • Source files (src/, app/) confirmed not affected by new patterns

The `_should_ignore` function only used `fnmatch.fnmatch()` which matches
from the start of the path. This means nested dependency directories like
`packages/app/node_modules/react/index.js` were NOT ignored — only
top-level `node_modules/` was caught.

This is a problem in monorepos, workspaces, and any project with nested
dependency directories. The graph would parse thousands of third-party
files, inflating build time and polluting blast radius queries.

Fix: check if any path segment matches the pattern prefix (e.g., if
"node_modules" appears anywhere in the path parts).

Also extends DEFAULT_IGNORE_PATTERNS to cover common frameworks:
- PHP/Laravel: vendor/, storage/, bootstrap/cache/, public/build/
- Ruby/Rails: vendor/bundle/, .bundle/
- Java/Kotlin: .gradle/, *.jar
- .NET/C#: bin/, obj/, packages/
- Dart/Flutter: .dart_tool/, .pub-cache/
- General: coverage/, .cache/, tmp/, .nuxt/
Copy link
Copy Markdown

@Akashnkumar1 Akashnkumar1 left a comment

Choose a reason for hiding this comment

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

Looks good to me

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.

Nested dependency dirs not ignored + missing framework patterns in defaults

2 participants