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

Does it work in Vscode's WSL environment? #48

Closed darkvertex closed 3 years ago

darkvertex commented 3 years ago

I've been using VSCode with the wonderful official WSL integration extension (that runs the core within WSL, the Windows Subsystem for Linux, while keeping the UI local.)

I'm getting a lot of incorrect warnings about --no-color flag not being supported so I checked #44 but the warnings are false. I do in fact have a recent version which has the flag:

> hadolint --version
Haskell Dockerfile Linter 2.3.0-no-git

When I check the Output console for the hadolint plugin, I see stuff like this:

[hadolint] hadolint: /home/alan/repos/myrepo copy/Dockerfile: openBinaryFile: does not exist (No such file or directory)

Is copy/Dockerfile supposed to be a path that the extension generates to temporarily lint?

What could the problem be? I'm on the latest extension version and latest stable VSCode release, if it helps.

michaellzc commented 3 years ago

@darkvertex

Would you provide all output from hadolint (in the output console) while having an opened Dockerfile in VS Code?

It should be something like this

[hadolint(3064) file:///Users/michael/Code/exiasr/hadolint-test] Started and initialize received
[hadolint(3064) file:///Users/michael/Code/exiasr/hadolint-test] Document is opened: file:///Users/michael/Code/exiasr/hadolint-test/dir2/Dockerfile
[hadolint(3064) file:///Users/michael/Code/exiasr/hadolint-test] Current settings: {"hadolintPath":"/usr/local/bin/hadolint","cliOptions":["--no-color"],"maxNumberOfProblems":100,"outputLevel":"warning"}
[hadolint] Running /usr/local/bin/hadolint /Users/michael/Code/exiasr/hadolint-test/dir2/Dockerfile --no-color in /Users/michael/Code/exiasr/hadolint-test

Additionally, would you run the following command in a WSL terminal and paste the output here.

$ which hadolit
$ hadolint --version
darkvertex commented 3 years ago

Sorry for not getting back to you but for one reason or another, I'm unable to reproduce the issue anymore in VSCode in WSL, so... yay?

felipemlemos commented 1 year ago

To whoever have a similar problem. Even if you have it in your PATH, you have to add hadolint to the 'Hadolint Path` option in vscode,