Skip to content

Add support for honoring .gitignore / .ignore patterns during filesystem discovery #452

@Montana

Description

@Montana

Hey all,

So the config-file-validator already supports excluding directories and file types through CLI flags and .cfv.toml, which is great. But in real repos, a lot of files we do not want to validate are already described in .gitignore or .ignore patterns. Right now that means users may need to duplicate ignore logic in multiple places.

It would be useful if the validator could optionally respect repository ignore rules during file discovery.

Proposed behavior

Add support for one of the following:

  • a new flag such as --respect-gitignore
  • or automatic detection when running inside a Git repository

When enabled, the validator should skip files/directories ignored by:

  • .gitignore
  • .git/info/exclude
  • optionally global Git ignore config
  • optionally .ignore

Why this would help

This would make the tool easier to use in larger repos and monorepos where generated/vendor/build output is already excluded from normal developer workflows.

Examples:

  • skip generated config artifacts under build output
  • avoid validating vendored third-party configs
  • reduce duplication between .gitignore and .cfv.toml
  • make local runs behave closer to what developers already expect from Git-aware tooling

Example

Today:

validator --exclude-dirs=node_modules,.git,dist,build .

Proposed:

validator --respect-gitignore .

Sincerely,
Michael

Metadata

Metadata

Assignees

Labels

CLIUpdate to the CLIhas-prThis issue has an associated PRvalidator-coreIssues that relate to the core validator functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions