mirror of
https://github.com/kucherenko/jscpd.git
synced 2026-09-19 08:11:03 +08:00
5cbd42f25a
Separate v4's two distinct ignore concepts that were incorrectly merged: - v4 ignore = file-level glob patterns (skip entire files during walk) - v4 ignorePattern = code-level regex patterns (skip matching tokens during detection, like v4 Prism grammar token injection) CLI and Config: - Add --ignore/-i flag for file-level glob patterns - Keep --ignore-pattern for code-level regex patterns - Add ignore field to ConfigFile (serde alias for kebab-case) - Stop merging ignore into ignorePattern in normalize_v4_config - Add Options.ignore, MergedConfig.ignore, RunConfig.ignore Tokenizer (core semantics fix): - Change code_ignore_patterns from per-token value matching to source-text regex matching matching v4 semantics - Add code_ignore_ranges() that matches regexes against source text and returns byte ranges, then uses existing ignore_ranges mechanism in push_token() to skip tokens overlapping those ranges - This correctly handles multi-token patterns like import.*from - Add regex dependency to cpd-tokenizer and cpd-finder Walker: - RunConfig.ignore maps to WalkConfig.ignore_patterns (file-level globs) - RunConfig.code_ignore_patterns maps to regex matching in tokenizer Tests: - 4 new tokenizer unit tests for code_ignore_ranges and source-text matching - 6 new integration tests for ignore/ignorePattern separation - 4 new config fixture files from real-world GitHub examples - 4 new CLI tests for --ignore vs --ignore-pattern - Validate against real-world .jscpd.json configs Clippy: fix bind_instead_of_map in walker.rs pattern_set
8 lines
206 B
JSON
8 lines
206 B
JSON
{
|
|
"path": ["./fixtures"],
|
|
"reporters": ["console"],
|
|
"gitignore": true,
|
|
"ignore": ["**/node_modules/**", "**/dist/**", "**/*.min.js"],
|
|
"ignorePattern": ["//\\s*ISC-License", "//\\s*MIT-License"]
|
|
}
|