config-file-validator icon indicating copy to clipboard operation
config-file-validator copied to clipboard

Add `--file-types` flag to include only specified config file types

Open kehoecj opened this issue 1 year ago • 4 comments

There isn't a way to limit the validation to only a subset of config file types. You can use --exclude-file-types to remove all the ones you do not want scanned but as that list has gotten bigger you'd have to do the following command if you only wanted JSON or XML: validator --exclude-file-types=yaml,toml,ini,properties,hcl,plist,csv,hocon,env,editorconfig. Not only is that hard to remember but even if you save the command you'd have to update it every time we add additional validation types. We need an option to specify which types to include - something like this: validator --file-types=xml,json. We need to also add CLI logic so --file-types and --exclude-file-types should not be used together.

Implementation should be fairly simple because it will be the inverse of --exclude-file-types

kehoecj avatar Oct 07 '24 19:10 kehoecj

Hey there ! I think I can work on this, can you please assign me this ?

Kinshuk0 avatar Oct 07 '24 21:10 Kinshuk0

@Kinshuk0 Done!

kehoecj avatar Oct 07 '24 21:10 kehoecj

@Kinshuk0 Haven't seen a PR for 2 weeks so opening this up to others

kehoecj avatar Oct 23 '24 14:10 kehoecj

I think building an exclude-file-types list based on file-types can be done to avoid duplicating the code in FSFinder. I have a PR #192 for this.

Is it a good idea?

gurukiran07 avatar Oct 25 '24 04:10 gurukiran07