stelligent / config-lint

Command line tool to validate configuration files
https://stelligent.github.io/config-lint/#/
MIT License
193 stars 39 forks source link

Question about Filenames to scan. #208

Open alexandresavicki opened 4 years ago

alexandresavicki commented 4 years ago

I'm trying to run config-lint on my terraform configuration files and I came across a possible problem.

If i run terraform init before running config-lint, a ocult directory .terraform will be created.

So when i run config-lint against my terrafom files, the config-lint will be scan all the *.tf files inside .terraform directory.

I'm trying to use the exclude and exclude-from command line parameters, but it doesn't seem to work recursively inside a directory:

Command line example.: config-lint -exclude .terraform/\* -debug -rules testerules.yml .

Exclude patterns: [.terraform/*]
Excluding file: .terraform/terraform.tfstate using pattern: .terraform/*
Filenames to scan: [.atlantis-enabled .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/.chglog/CHANGELOG.tpl.md .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/.chglog/config.yml .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/.editorconfig .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/.gitignore .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/.pre-commit-config.yaml .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/CHANGELOG.md .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/LICENSE .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/Makefile .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/README.md .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/examples/github-repository-webhook/README.md .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/examples/github-repository-webhook/main.tf .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/examples/github-repository-webhook/outputs.tf .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/examples/github-repository-webhook/terraform.tfvars.sample .terraform/modules/atlantis/terraform-aws-atlantis-2.20.0/examples/github-repository-webhook/variables.tf

It's possible ignore this .terraform/* directory from files to scan?

lijok commented 4 years ago

Seems like it's using string.Match to do the matching, which uses shell syntax for the matching This should move to using a regex or something to allow for usable exclude filters