michaellzc / vscode-hadolint

VSCode extension to integrate hadolint, a Dockerfile linter, into VSCode
https://marketplace.visualstudio.com/items?itemName=exiasr.hadolint
MIT License
78 stars 5 forks source link

Add support for .hadolint.yml files #14

Closed jhuiting closed 6 years ago

jhuiting commented 6 years ago

I really like using this extension thus far, but I've run into a small issue regarding configuration. I've a
.hadolint.yml file in the root of my repository, which contains some Hadolint rules I'd like to ignore. On the CI I pass this via the -c option to Hadolint. I would like to specify this file as the default config file, and use it to lint all Docker files.

Example structure:

- .hadolint.yml
- folder1
   - Dockerfile
- folder2
   - Dockerfile
   - subfolder1
      - Dockerfile

I think there are multiple ways to solve this, and adding an explicit config setting is the easiest I think? We could add default behaviour to take the .hadolint.yml file in the same folder. Let me know if you agree to add this functionality. I can probably work on a MR somewhere this weekend.

michaellzc commented 6 years ago

hi @jhuiting

https://github.com/hadolint/hadolint/blob/master/README.md#configure

By default, hadolint will look for .hadolint.yaml within the current directory. Unfortunately, they do not like .hadolint.yml 😅... That's why hadolint is not picking up your .hadolint.yml.

We can defnitely add a config setting for custom hadolint config file.

However, I think the default setting should be empty because hadolint will look for .hadolint.yaml at project root anyway. For uncommon case like .hadolint.yml or config file is not in the project root, user can use the new config setting to do the trick.

Please go for it and let me know if you have any question.

jhuiting commented 6 years ago

@ExiaSR Thanks for the fast response. I missed the fact that .hadolint.yaml works, so I've decided to just rename the extension of the file from yml to yaml. Works like a charm, save the hassle to add this functionality for now. If there are other people interested, I can still add this functionality.