pantajoe / vscode-elixir-credo

VSCode support for Elixir Linter 'Credo'.

Home Page:https://marketplace.visualstudio.com/items?itemName=pantajoe.vscode-elixir-credo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error mix credo returned empty output

RafaelCamarda opened this issue Β· comments

I've received a lot of times errors like this one:

image

The curious thing is, in my settings I have:

"elixir.credo.executePath": "/home/rafael/.asdf/installs/elixir/1.11.3/bin/mix"

So, my path is one, but the error shows another one. Seems that the config is not being respected πŸ€”

I have already tried with /home/rafael/.asdf/shims/mix as well but the error remains the same.

Do you have any clues that something that I should do to stop the error? Or maybe this could be a bug?

I'm currently using asdf to manage my elixir versions.

Hey @RafaelCamarda !

I believe that you are setting your elixir.credo.executePath in a false manner. You are supposed to specify the execute location of the mix binary, not the full path of the binary, i.e., in your case:
It should be "/home/rafael/.asdf/installs/elixir/1.11.3/bin" if you wanted to always use this path. However, I also use asdf and I would recommend you to use "/home/rafael/.asdf/shims".

This, however, shouldn't be related to the error you are getting. Have you tried to execute mix credo in your elixir project directory? And I would be grateful if you could send me the output of this command!

Just an Edit:

I just published a new version that improves error reporting. Maybe you could download it, enable the extension's configuration "elixir.credo.enableDebug": true, repeat your steps and send me the output of the extension's output channel? Would be very much appreciated!

Ok, now I'm using the proper path:
/home/rafael/.asdf/shims

I had this error:

image

When I've tried to run in my bash the same command, it gets stucked. But, regular mix credo works fine.

rafael@linux-mint:inmana $ /home/rafael/.asdf/shims/mix credo --format json --read-from-stdin --config-file .credo.exs --config-name default --strict

^C
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
^Crafael@linux-mint:inmana $ /home/rafael/.asdf/shims/mix credo
Checking 23 source files ...

  Code Readability                                                                                                                                                                            
┃ 
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana_web/telemetry.ex:1:11 #(InmanaWeb.Telemetry)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana/welcomer.ex:1:11 #(Inmana.Welcomer)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana/restaurants/create.ex:1:11 #(Inmana.Restaurants.Create)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana/restaurant.ex:1:11 #(Inmana.Restaurant)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana.ex:1:11 #(Inmana)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.2 seconds (0.05s to load, 0.1s running 45 checks on 23 files)
56 mods/funs, found 5 code readability issues.

Showing priority issues: ↑ β†— β†’  (use `mix credo explain` to explain issues, `mix credo --help` for options).

Running just mix credo works fine as well:

rafael@linux-mint:inmana $ mix credo
Checking 23 source files ...

  Code Readability                                                                                                                                                                            
┃ 
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana_web/telemetry.ex:1:11 #(InmanaWeb.Telemetry)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana/welcomer.ex:1:11 #(Inmana.Welcomer)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana/restaurants/create.ex:1:11 #(Inmana.Restaurants.Create)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana/restaurant.ex:1:11 #(Inmana.Restaurant)
┃ [R] β†’ Modules should have a @moduledoc tag.
┃       lib/inmana.ex:1:11 #(Inmana)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.2 seconds (0.05s to load, 0.1s running 45 checks on 23 files)
56 mods/funs, found 5 code readability issues.

Showing priority issues: ↑ β†— β†’  (use `mix credo explain` to explain issues, `mix credo --help` for options).

Another update:

Seems that version 0.41.0 works fine with the right path:

image

But version 0.42.0 doesn't πŸ€”
image

When I've tried to run in my bash the same command, it gets stucked. But, regular mix credo works fine.

The reason for this is that this command used by vscode normally provides the file contents as stdin. If you do not provide anything it expects user input. So that's expected behavior.

Seems that version 0.41.0 works fine with the right path:

That's strange. The error you sent me in the first place happened with version 0.4.1, didn't it?

But version 0.42.0 doesn't πŸ€”

Turns out, I let the linting fail even if there was no error. Error status code 4 means something regarding the kinds of linting issues credo detected. πŸ˜… Therefore, I again released a new version 0.4.3 which should fix this. It should be available any moment now.

Could you maybe send me the content logged into the output channe at the bottom (its name is "Elixir Linter (Credo)", just as the extension is named) if you enable this extension's debug mode by setting "elixir.credo.enableDebug" to true after updating (and if the error still occurs)?

Sorry for the late answer, but it seems that everything is working fine right now and we can close this issue. I let you know if something else occurs in the future. 😁

Okay then, thanks πŸ‘πŸΌ