feat: add --ignore-file filtering#512
Open
macayu17 wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for applying additional gitignore-style ignore files during file discovery, configurable via CLI flag, config file key, and environment variable.
Changes:
- Introduces
--ignore-file(repeatable) andignore-filesconfig key, plusCFV_IGNORE_FILESenv var support. - Extends filesystem finder to load ignore patterns from explicit ignore files (even when not in a Git repo).
- Updates docs, schema, changelog, and adds unit/integration tests covering the new behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/reference/environment-variables.md | Documents CFV_IGNORE_FILES mapping and format. |
| website/docs/reference/configuration-keys.md | Adds ignore-files config key to the reference table. |
| website/docs/reference/cli-flags.md | Adds -ignore-file to CLI flags reference. |
| website/docs/guides/filtering-exclusion.md | Adds a guide section explaining ignore files and updates evaluation order. |
| website/docs/guides/configuration-file.md | Adds ignore-files to examples and key table. |
| pkg/finder/fsfinder.go | Implements loading ignore patterns from explicit ignore files. |
| pkg/finder/finder_test.go | Adds unit tests for ignore-file behavior. |
| pkg/configfile/schema.json | Adds JSON schema entry for ignore-files. |
| pkg/configfile/configfile_test.go | Adds config parsing test for ignore-files. |
| pkg/configfile/configfile.go | Adds IgnoreFiles field to config struct. |
| cmd/validator/validator_test.go | Adds tests for --ignore-file flags and CFV_IGNORE_FILES. |
| cmd/validator/validator.go | Adds --ignore-file, env var parsing, config-file application, and wiring into finder opts. |
| cmd/validator/testdata/ignore_file.txtar | Adds integration-style test scenarios for ignore files. |
| CHANGELOG.md | Notes the new --ignore-file option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #457.
Summary
Adds a repeatable
--ignore-fileflag for gitignore-style pattern files such as.dockerignoreand.prettierignore. Each file is resolved relative to the search path root, missing files are skipped, and multiple ignore files are additive.This also wires the same behavior through
ignore-filesin.cfv.tomland the comma-separatedCFV_IGNORE_FILESenvironment variable. The new behavior is covered in finder unit tests and CLI testscript cases, with docs updated for the new flag, config key, and env var.Verification
go test ./pkg/finder ./pkg/configfile ./cmd/validator -run "Test_fsFinderGitignore|Test_fsFinderIgnoreFiles| Test_fsFinderMultipleIgnoreFiles|TestLoadValid|Test_ignoreFilesEnvVar|Test_getFlags|TestScript/ignore_file" -count=1go vet,gofmt,golangci-lint,go generatediff check, Linuxbuild,
go test -cover ./..., nested justfile tests93.3%