Add --exclude flag to scan command for glob-based file exclusion#86
Open
Ibrahimrahhal wants to merge 4 commits intomainfrom
Open
Add --exclude flag to scan command for glob-based file exclusion#86Ibrahimrahhal wants to merge 4 commits intomainfrom
Ibrahimrahhal wants to merge 4 commits intomainfrom
Conversation
Add a new --exclude CLI flag that accepts comma-separated glob patterns to exclude files from scanning. Works with both targeted scans (--target) and full repository scans. The exclude filtering is applied at three levels: - targets.rs: resolve_targets_with_exclude filters files after target resolution using glob matching against repo-relative paths - blast.rs: passes exclude through to both target resolution and zip creation - generic.rs: create_zip_from_target applies user exclude patterns during the full-scan directory walk Includes 11 new unit tests covering glob set construction, pattern matching, and edge cases. Co-authored-by: Ibrahim Rahhal <ibrahim.rahhal3636@gmail.com>
When --exclude is used without --target (full repo scan), print the exclude patterns so the user knows they took effect. Co-authored-by: Ibrahim Rahhal <ibrahim.rahhal3636@gmail.com>
Co-authored-by: Ibrahim Rahhal <ibrahim.rahhal3636@gmail.com>
Co-authored-by: Ibrahim Rahhal <ibrahim.rahhal3636@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a new
--excludeCLI flag to thescancommand that accepts comma-separated glob patterns to exclude files from scanning. This mirrors the existing--targetflag but for exclusion.Usage
Changes
src/main.rs: Added--excludeCLI argument to theScancommand (blast-only, matching other blast-specific flags), and passes it through toblast::run.src/targets.rs: Addedresolve_targets_with_exclude()which filters resolved files against user-provided exclude glob patterns. Added public helpersbuild_user_exclude_glob_set()andis_file_excluded()for use by the zip creation path. Added 11 unit tests.src/scanners/blast.rs: Updatedrun()signature to acceptexclude: Option<String>, passes it to bothresolve_targets_with_exclude(for target validation/display) andcreate_zip_from_target(for zip packaging).src/utils/generic.rs: Updatedcreate_zip_from_target()to accept and apply user exclude patterns. For targeted scans, exclusion is handled byresolve_targets_with_exclude. For full repo scans (no--target), exclusion is applied during the directory walk.Testing
cargo buildcompiles cleanly with no warnings--helpoutput correctly shows the new--excludeflag