-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[VSCode] Error "command /usr/bin/mix credo
returns empty output"
#8
Comments
Hi! Thanks for submitting this issue. That seems very strange to me. Have you encountered this when opening a certain file or simply always when opening a workspace? /usr/bin/mix credo --format json --read-from-stdin --config-file .credo.exs --config-name default < "<content of any .ex/.exs file>" Normally, this error occurs if mix is run in a directory where not all dependencies are installed or where no |
@pantajoe |
Okay, thanks for the update. I'll look into that to support multi-workspace scenarios. |
Hey there, I received the same error upon starting VSCode, however I only had a single project in the workspace. I ran your command from above.
So, I installed jason globally as well with
So, the problem was not that credo returned an empty output, but that it threw an exception which the VSCode extension didn't pick up. I'm not sure how easy it is to listen for exceptions, but if possible, I'd suggest the extension shows a different error-message in case an exception occurs. But aside from this litte FYI: Thank you very much for this very helpful extension :) |
@PJUllrich Thanks for pointing this out! Currently, I am capturing exceptions if credo's command returns an non-zero exit status. Just to clarify, the command that returns the elixir exception does not return a success status and, thus, no JSON output, does it? |
That is correct I believe. No JSON output is returned, only what you see above. I believe that that's not considered a "successful return status" indeed. |
@lqmanh Hey, I just released a new version that now supports having multiple folders in one workspace. So if you have 2 or more folders opened, and only one elixir project, no more errors should occur, even if the elixir project is not the first folder in the list. |
@pantajoe Thank you! |
I'm still getting this error in 0.4.1: Here's from the output:
I've run both |
Have you run |
Yes here's the output:
And running the command above:
|
And the problem still occurs? How do you have your project opened in vscode? As a saved workspace? As a folder? |
Yep still occurs. I've opened my project as a folder. |
Hmm, could you activate the configuration option |
Where? In |
In VS Code settings |
@hfjallemark
The configuration option |
That seemed to work! Awesome, thanks 👍 |
Great! @hfjallemark Could you maybe send me the output of your command |
Sure, here it is: {
"config": {
"checks": [
"Elixir.Credo.Check.Consistency.ExceptionNames",
"Elixir.Credo.Check.Consistency.LineEndings",
"Elixir.Credo.Check.Consistency.ParameterPatternMatching",
"Elixir.Credo.Check.Consistency.SpaceAroundOperators",
"Elixir.Credo.Check.Consistency.SpaceInParentheses",
"Elixir.Credo.Check.Consistency.TabsOrSpaces",
"Elixir.Credo.Check.Design.AliasUsage",
"Elixir.Credo.Check.Design.TagTODO",
"Elixir.Credo.Check.Design.TagFIXME",
"Elixir.Credo.Check.Readability.AliasOrder",
"Elixir.Credo.Check.Readability.FunctionNames",
"Elixir.Credo.Check.Readability.LargeNumbers",
"Elixir.Credo.Check.Readability.MaxLineLength",
"Elixir.Credo.Check.Readability.ModuleAttributeNames",
"Elixir.Credo.Check.Readability.ModuleNames",
"Elixir.Credo.Check.Readability.ParenthesesInCondition",
"Elixir.Credo.Check.Readability.ParenthesesOnZeroArityDefs",
"Elixir.Credo.Check.Readability.PredicateFunctionNames",
"Elixir.Credo.Check.Readability.PreferImplicitTry",
"Elixir.Credo.Check.Readability.RedundantBlankLines",
"Elixir.Credo.Check.Readability.Semicolons",
"Elixir.Credo.Check.Readability.SpaceAfterCommas",
"Elixir.Credo.Check.Readability.StringSigils",
"Elixir.Credo.Check.Readability.TrailingBlankLine",
"Elixir.Credo.Check.Readability.TrailingWhiteSpace",
"Elixir.Credo.Check.Readability.UnnecessaryAliasExpansion",
"Elixir.Credo.Check.Readability.VariableNames",
"Elixir.Credo.Check.Refactor.CondStatements",
"Elixir.Credo.Check.Refactor.CyclomaticComplexity",
"Elixir.Credo.Check.Refactor.FunctionArity",
"Elixir.Credo.Check.Refactor.LongQuoteBlocks",
"Elixir.Credo.Check.Refactor.MatchInCondition",
"Elixir.Credo.Check.Refactor.NegatedConditionsInUnless",
"Elixir.Credo.Check.Refactor.NegatedConditionsWithElse",
"Elixir.Credo.Check.Refactor.Nesting",
"Elixir.Credo.Check.Refactor.UnlessWithElse",
"Elixir.Credo.Check.Refactor.WithClauses",
"Elixir.Credo.Check.Warning.ApplicationConfigInModuleAttribute",
"Elixir.Credo.Check.Warning.BoolOperationOnSameValues",
"Elixir.Credo.Check.Warning.ExpensiveEmptyEnumCheck",
"Elixir.Credo.Check.Warning.IExPry",
"Elixir.Credo.Check.Warning.IoInspect",
"Elixir.Credo.Check.Warning.OperationOnSameValues",
"Elixir.Credo.Check.Warning.OperationWithConstantResult",
"Elixir.Credo.Check.Warning.RaiseInsideRescue",
"Elixir.Credo.Check.Warning.UnusedEnumOperation",
"Elixir.Credo.Check.Warning.UnusedFileOperation",
"Elixir.Credo.Check.Warning.UnusedKeywordOperation",
"Elixir.Credo.Check.Warning.UnusedListOperation",
"Elixir.Credo.Check.Warning.UnusedPathOperation",
"Elixir.Credo.Check.Warning.UnusedRegexOperation",
"Elixir.Credo.Check.Warning.UnusedStringOperation",
"Elixir.Credo.Check.Warning.UnusedTupleOperation",
"Elixir.Credo.Check.Warning.UnsafeExec"
],
"files": [
"lib/my_app.ex",
"lib/my_app/application.ex",
"lib/my_app/repo.ex",
"lib/my_app_web.ex",
"lib/my_app_web/endpoint.ex",
"lib/my_app_web/error_view.ex",
"lib/my_app_web/hello/controller.ex",
"lib/my_app_web/hello/templates/index.html.exs",
"lib/my_app_web/hello/view.ex",
"lib/my_app_web/home/controller.ex",
"lib/my_app_web/home/templates/index.html.exs",
"lib/my_app_web/layout/templates/app.html.exs",
"lib/my_app_web/layout/view.ex",
"lib/my_app_web/router.ex",
"test/support/conn_case.ex",
"test/support/data_case.ex",
"test/test_helper.exs",
"test/my_app_web/controllers/hello_controller_test.exs",
"test/my_app_web/controllers/home_controller_test.exs",
"test/my_app_web/features/home_test.exs"
]
},
"system": {
"credo": "1.5.4-ref.main.7a25d44+uncommittedchanges",
"elixir": "1.11.2",
"erlang": "23"
}
} |
@hfjallemark Thanks a lot! It does look correct, though. |
@hfjallemark One more question: |
Looks like I'm getting a different error now:
|
In addition to the error above I'm also getting:
|
Hm, this is definitely weird. |
First of all thanks for this extension. I have the same error: this is the output of Seems that I have the error only on .exs files
|
@gigitux What OS do you use? And what does the output channel show if you have the configuration option |
OSX 11.4 Warning
Error
|
@gigitux So weird. And if you set |
I got the same error that is mentioned in the title. However I did managed to fix it. I tried to retrace my steps, so I could share them with you guys. Maybe this'll help someone. I'm running Ubuntu 18.04 and VSCodium (VSCode without proprietary parts). I wanted to run credo as standalone installation instead of adding it to a project. After installing the extension I followed the instructions on https://hexdocs.pm/credo/basic_usage.html with a few minor exceptions with the folder structures. Here are the steps copied from hexdocs . git clone git@github.com:rrrene/bunt.git
cd bunt
mix archive.build
mix archive.install
cd -
git clone git@github.com:rrrene/credo.git
cd credo
mix deps.get
mix archive.build
mix archive.install After this:
I no longer get the error mentioned in the title. |
One more thing I noticed. This problem could be related to On opening the project with VSCodium I got the error mentioned in the title. Then I tried to generate |
@lvl3 Thanks a lot for clarifying the problem and for the explanation of dour efforts! Would you like to create a PR where you add your remarks and explanations to the README of the extension? 😊 |
@pantajoe Sure. I can do that. I'll try to replicate the issue on my other machine first to see what was the actual cause. It might take me a couple of days, but I'll try to do this during this week. |
@lvl3 Great, thank you. Very much appreciated! |
Steps to solve this problem locally are now in the README. Thanks again @lvl3! |
@pantajoe sorry to comment to a closed issue but seems to me the most appriopiate place. Does this work with workspaces that contain multiple elixir projects? per/directory in workspace settings per directory are not shown in the UI: |
@sgobotta Yes, that should work. I introduced it a while ago. I published a new version (0.6.2) where you should be able to configure most settings within different folders of a workspace. Can you check if everything works fine now? |
I can't feel worse enough, sorry for the delay. Everything seems fine! |
Hi,
I've been trying to install this extension but encountered the error above. Here's full version:
That's weird because I already have credo installed and I can run
mix credo
manually in terminal without problem.Could you please have a look at this? Thank you for your great work.
The text was updated successfully, but these errors were encountered: