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

Comprehensively broken in current VSCode #62

Closed GrabCAD-Gary closed 2 years ago

GrabCAD-Gary commented 2 years ago

Describe the bug The extension v1.1.0 doesn't work at all. It's completely lifeless.

To Reproduce Steps to reproduce the behavior:

  1. Open a Dockerfile
  2. Enter some invalid code
  3. See no response in the editor window or the Problems tab.

Expected behaviour A working linter.

Screenshots or Dockerfile N/A

Environment and version (please complete the following information):

Debug information N/A

Additional context

No amount of entering paths, restarting VSCode, re-installing hadolint, etc worked.

I tried installing previous versions from the extension's cogwheel icon on the extension sidebar. After reverting to 1.0.2 normal behaviour was restored.

NB The sample configuration in the readme is also wrong. All entries should be preceeded by hadolint. otherwise they are disabled by VSCode with "unknown configuration" e.g.

 "hadolint.hadolintPath": "path\\to\\hadolint"

The instruction to Windows users to enter double slashes on the path configuration box is also misleading. VSCode automatically doubles them when writing them to settings.json so doing it here results in 4 slashes per separator.

per-oestergaard commented 2 years ago

I see the same. I think the format of hadolint changed as I get

[{"line":9,"code":"DL3018","message":"Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`","column":1,"file":"/folder/Dockerfile","level":"warning"}]

So I guess the patterns in https://github.com/michaellzc/vscode-hadolint/blob/623481a60cafe315df9bbe6656f82022165109f5/server/src/service/hadolint.ts#L10 needs to be updated.

If use the docker version of hadolint (hadolint/hadolint:latest). --version returns

Haskell Dockerfile Linter v2.8.0-0-g398770f-dirty
michaellzc commented 2 years ago

I see the same. I think the format of hadolint changed as I get

[{"line":9,"code":"DL3018","message":"Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`","column":1,"file":"/folder/Dockerfile","level":"warning"}]

So I guess the patterns in

https://github.com/michaellzc/vscode-hadolint/blob/623481a60cafe315df9bbe6656f82022165109f5/server/src/service/hadolint.ts#L10

needs to be updated. If use the docker version of hadolint (hadolint/hadolint:latest). --version returns

Haskell Dockerfile Linter v2.8.0-0-g398770f-dirty

Hey @per-oestergaard, thanks for reporting the issue.

I can confirm I am able to reproduce it locally, so I will definitely take a look some time soon.

michaellzc commented 2 years ago

@per-oestergaard

The problem happened to go away after I bump some unrelated dependencies and reload the window a couple of times 🤷‍♀️. Typical VS Code behaviour, especially LSP is involved.

This is tested on both the latest stable and insiders built on Intel-based and Apple Silicon Macbook. For windows users, I probably won't be able to look anytime soon.

Would you try again? Feel free to file a new issue if it doesn't work for you.

GrabCAD-Gary commented 2 years ago

I upgraded to 1.1.1 and it does now seem to work on VSCode 1.64.2. Thanks.

per-oestergaard commented 2 years ago

Allow me do reopen this. Unfortunately, I see no change on Windows. And I do not understand why lineNumber is wanted by this plugin as hadolint always returns line. The message I get is hadolint: Cannot read property 'lineNumber' of null. It could smell of some issue with the output being piped/sent back to the extension. Can I debug this somehow?

per-oestergaard commented 2 years ago

Converted my setup to a .devcontainer using the official wrapper script https://github.com/hadolint/hadolint/blob/fcb52b2a1904789339faded7dd3381a6d6b95a98/README.md?plain=1#L111-L116

Now I get the error hadolint: Cannot read property 'toString' of null

Json output is still

[{"line":28,"code":"DL3025","message":"Use arguments JSON notation for CMD and ENTRYPOINT arguments","column":1,"file":"-","level":"warning"}]

Maybe if the extension could log the output its gets back when calling hadolint?