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

Linter doesn't show anything in umbrella application on windows 10

talismandev opened this issue · comments

Hello!

I have installed credo linter for Elixir Phoenix umbrella app.
mix credo works fine in console.
But, unfortunately, in vscode linter doesn't show any messages.

Here is my vscode setup:

Version: 1.55.2 (system setup)
commit: 3c4e3df9e89829dce27b7b5c24508306b151f30d
Date: 2021-04-13T09:35:57.887Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.18363

.credo.exs file was generated by mix credo.gen.config command.

I have created some module in apps/ folder, like this:
http://prntscr.com/11iklcd

and see strange behavior in terminal:
http://prntscr.com/11ikhyy

No linting tips shown.

And in non-umbrella app everything works as expected:
http://prntscr.com/11ikrzc

I would appreciate any help to solve this question.
Thanks!

Hey @talismandev !

The strange warning message you see comes from the mix credo command.
I have not worked with umbrella projects before, therefore I do not exactly know where the issue comes from.
But where are the files .mix.exs (where credo is defined in the deps) and .credo.exs located? In the root directory where apps/ lives, or within?

But where are the files .mix.exs (where credo is defined in the deps) and .credo.exs located? In the root directory where apps/ lives, or within?

Both are defined in the root directory.
credo version:
{:credo, "<= 1.4.0", only: [:dev, :test], runtime: false}

Okay, and how did you open your project in VS Code? Did you open an app that lives inside the apps/ directory or did you open the root directory?

Okay, and how did you open your project in VS Code? Did you open an app that lives inside the apps/ directory or did you open the root directory?

I open the root directory to work with the whole project.

Hm, very strange.

Okay, I just published a new version (0.4.2) of this extension that improves error reporting. Maybe you could download it (the new version will probably be available in a few minutes), enable the extension's configuration option "elixir.credo.enableDebug": true, reload your VS Code Window and re-open your project and an elixir file, and show me the output channel of this extension? That'd be great!

Sure.
After 0.4.2 installation I see the following:
http://prntscr.com/11it76a
http://prntscr.com/11itcc2

By the way:
while extension executing credo command I am seeing this:

Retreiving credo information: Executing credo command C:\Program Files (x86)\Elixir\bin\mix.bat credo info --format json --verbose for 'd:\umb_project\apps\some_module\lib\some_module.ex' in directory 'd:\umb_project'

If I ctrl + click on link to jump to the file, I see error: File not found (from vscode).

Don't know, could it be helpful or not.

If I run the command from the terminal:
mix credo --format json --verbose d:\umb_project\apps\some_module\lib\some_module.ex

the output is:
{
"issues": []
}

and finally, If I just run:
mix credo d:\umb_project\apps\some_module\lib\some_module.ex

I see this:

Analysis took 0.02 seconds (0.01s to load, 0.01s running 46 checks on 0 files)
0 mods/funs, found no issues.

My suggestion is: credo doesn't see the file.

If I change slashes in filepath, like this:
mix credo d:/umb_project/apps/some_module/lib/some_module.ex

The output works as expected:
Modules should have a @moduledoc tag.

It looks like, vscode recognizes apostrophe at the end of the line as the part of the filename (and can't find file).

This should not have anything to do with it, but thanks for pointing it out! I'll remove these apostrophes in the logs in the future.

If I change slashes in filepath, like this:
mix credo d:/umb_project/apps/some_module/lib/some_module.ex

This is so weird 😄 Apparently elixir writes this warning to the stderr. Let me draft a new version and I'll get back to you in minute as soon as it's released.

This should not have anything to do with it, but thanks for pointing it out! I'll remove these apostrophes in the logs in the future.

this is my misunderstanding. Everything is fine with apostrophes. The link is working on another OS as expected.
There is a problem with slashes in filepath on windows.

This is so weird 😄 Apparently elixir writes this warning to the stderr. Let me draft a new version and I'll get back to you in minute as soon as it's released.

I have installed 0.4.3 and this is the debug output:

Elixir Linter (Credo) initiated successfully.

An error occurred: 'warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
nofilename:41

' - Error Object: null

Okay, this makes sense. The warning you see is a compiler warning by Elixir. I believe the file you want linted has such a problem of ambiguous pipes. But apparently this is written to the stderr even though it is no error.
That's why the linting process would be interrupted.

As of v0.4.4 which is available now, this should not happen anymore. Can you verify this after upgrading to 0.4.4?

You were right!
Probably one of the files in umbrella has such a problem with pipes.

After 0.4.4 installation the lint process fixed.

Thank you so much!

Great, thanks for your help during debugging! 😄