The motivation of the PR is in many repositories; we don't want to include some files, e.g., tests*)
and it may also include a file that would be either broken or meaningless. However, all these files will not only affect the processing time of pyright-scip, but also will cause abortion. One example I showed below is the failed log while I process the sympy repo. I also attached the success log after applying our new exclude pattern.
Summary
This PR adds the ability to exclude files and directories from SCIP indexing using command-line flags or a configuration file. The exclusion feature supports both exact paths and glob patterns (e.g., test_*), and works as a filter that gracefully handles non-matching patterns without errors.
Changes Made
1. MainCommand.ts
Added exclude?: string[] to IndexOptions interface
Added excludeConfig?: string to IndexOptions interface
Added --exclude <paths...> flag to accept multiple file/directory paths
Added --exclude-config <file> flag to accept a config file with exclusion paths
2. indexer.ts
Added import { minimatch } from 'minimatch' for glob pattern matching
Implemented exclusion logic after targetOnly filtering (lines 122-179)
Reads patterns from --exclude flag
Reads patterns from config file if --exclude-config is provided
Config file supports:
Pattern matching features:
Exact path matching (original functionality)
Glob patterns: dir*, file*, tests/**, etc.
Relative and absolute paths
Works as a filter - patterns matching nothing don't cause errors
3. package.json
Added minimatch dependency for glob pattern matching
Usage
Exclude specific files/directories via command line:*
scip-python index --project-name=myproject --exclude path/to/broken.py --exclude path/to/circular/
Exclude using patterns:*
scip-python index --project-name=myproject --exclude "test_*""build/**"
Exclude using a config file:*
scip-python index --project-name=myproject --exclude-config=.scipignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The motivation of the PR is in many repositories; we don't want to include some files, e.g., tests*)
and it may also include a file that would be either broken or meaningless. However, all these files will not only affect the processing time of pyright-scip, but also will cause abortion. One example I showed below is the failed log while I process the sympy repo. I also attached the success log after applying our new exclude pattern.
Summary
This PR adds the ability to exclude files and directories from SCIP indexing using command-line flags or a configuration file. The exclusion feature supports both exact paths and glob patterns (e.g., test_*), and works as a filter that gracefully handles non-matching patterns without errors.
Changes Made
1. MainCommand.ts
2. indexer.ts
3. package.json
Usage
Benefits
Testing
The feature can be tested by:
Using --exclude with exact paths
Using --exclude with glob patterns like test_*
Using --exclude-config with a file containing mixed patterns and comments
Verifying that non-matching patterns don't cause errors
Log when directly indexing the sympy
Log after the exclude feature applied