mfussenegger / nvim-lint

An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
GNU General Public License v3.0
2.03k stars 209 forks source link

jq cannot run: Linter command `cmd.exe` exited with code: 5 #651

Open Ra2-IFV opened 2 months ago

Ra2-IFV commented 2 months ago
    lint.linters.jq_custom = {
      cmd = "jq",
      stdin = true,
      args = { "." },
      stream = "stderr",
      ignore_exitcode = false,
      parser = require("lint.parser").from_pattern(
        "^parse error: (.+) at line (%d+), column (%d+)$",
        { "message", "lnum", "col" },
        nil,
        nil,
        nil
      ), 
    }

if I ignore exit code, it still does nothing at all. I googled for cmd exit status 5 and it looks like a permission problem, but jq worked well with :!cat % | jq .

fredrikfoss commented 2 months ago

Remove the ^ in the pattern or append jq to it. jq errors start with jq (at least on Linux). Ex. error: jq: parse error: Expected ... line x, column y. Also, the exit status 5 is solved by setting ignore_exitcode to true as you described.

Ra2-IFV commented 2 months ago

Something is wrong Linter command ``cmd.exe`` exited with code: 5 It can't be cmd.exe, it should be jq.exe Also, jq doen't has exit code 5

Ra2-IFV commented 2 months ago

Remove the ^ in the pattern or append jq to it. jq errors start with jq (at least on Linux). Ex. error: jq: parse error: Expected ... line x, column y.

Tried but still not working.

Ra2-IFV commented 2 months ago

Turns out there is a space at the end of the string

^jq: parse error: (.+) at line (%d+), column (%d+)%s$

Or simply remove the $ anchor. Should I open a pull request for this? Not sure if someone else is having the same problem, or use %s? to match space instead. I'm using bash from msys2 on Windows 10

Ra2-IFV commented 1 month ago

Hello, hello? What should I do now? It looks core devs are not very active...