fix(prefilter): use token-boundary matching for test and migration framework detection - #68
Adityakk9031 wants to merge 2 commits into
Conversation
…amework detection
| ]; | ||
|
|
||
| test_patterns.iter().any(|pattern| imports_text.contains(pattern)) | ||
| test_patterns.iter().any(|pattern| Self::matches_token_or_module(imports_text, pattern)) |
There was a problem hiding this comment.
vitest, Go testing, and testify no longer match the test patterns, so their imports are scanned. could we retain explicit patterns for these framework roots while preserving the boundary fix?
There was a problem hiding this comment.
@juangaitanv Thanks for the review! Added explicit patterns for "testing", "testify", "vitest", and "github.com/stretchr/testify" to test_patterns while retaining token boundary checking. Added unit test file_with_testing_or_vitest_import_is_skipped.
| "migration", | ||
| "migrations", | ||
| "migrate", |
There was a problem hiding this comment.
from django.db import migrations no longer matches a migration pattern, so those files are scanned in general mode. could we retain generic migration indicators while treating _ and digits as identifier characters?
There was a problem hiding this comment.
@juangaitanv Restored "migration" and "migrations" to migration_patterns, and updated is_identifier_character to treat [A-Za-z0-9_] as non-boundary identifier characters. Now from django.db import migrations matches and is skipped, while identifiers like attestation or user_migration are not falsely matched. Added unit tests for both cases.
Summary