michaellzc / vscode-hadolint

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

"Cannot read properties of null (reading 'toString')" when hadolint binary is not executable #65

Closed wb-joona closed 2 years ago

wb-joona commented 2 years ago

Describe the bug When the hadolint binary is missing execution permissions or is just missing completely, the extension blows up with hadolint: Cannot read properties of null (reading 'toString'). A more helpful error message could be more user friendly.

To Reproduce Steps to reproduce the behavior:

  1. Download the hadolint 2.10.0 binary into your $PATH
  2. Try to lint a Dockerfile
  3. Error
  4. Grant execute permissions on hadolint binary
  5. Lint Dockerfle
  6. Works

Expected behaviour I would expect the extension to tell me that something went wrong when executing the hadolint binary, instead of blowing up internally.

Environment and version (please complete the following information):

Debug information

Provide all output from hadolint (in the output console) while having an opened Dockerfile in VS Code.

It should produce something like this

[hadolint(1003) file:///workspace] Started and initialize received
[hadolint(1003) file:///workspace] Document is opened: file:///workspace/Dockerfile.prod
[hadolint(1003) file:///workspace] Document is changed: file:///workspace/Dockerfile.prod
[hadolint(1003) file:///workspace] Current settings: {"hadolintPath":"/home/user/.bin/hadolint","cliOptions":["--no-color"],"maxNumberOfProblems":100,"outputLevel":"warning"}
[hadolint] Running /home/user/.bin/hadolint /workspace/Dockerfile.prod --no-color in /workspace

Additional context image

braisF commented 2 years ago

Hi there, same problem here.

I've been reviewing the extension configuration but I didn't found where the problem is.

I'm using VSCode in Windows with the default configuration.