Comments (38)
@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.
from vscode-elixir-credo.
Hey there, I received the same error upon starting VSCode, however I only had a single project in the workspace.
It turned out that my globally installed credo
was missing the jason
dependency. Here's how I found out:
I ran your command from above.
> /Users/pullrich/.asdf/shims/mix credo --format json --read-from-stdin --config-file .credo.exs --config-name default < ./lib/rollbar.ex
** (UndefinedFunctionError) function Jason.encode!/2 is undefined (module Jason is not available)
Jason.encode!(%{"issues" => []}, [pretty: true])
lib/credo/cli/output/formatter/json.ex:15: Credo.CLI.Output.Formatter.JSON.print_map/1
lib/credo/cli/command/suggest/suggest_command.ex:67: Credo.CLI.Command.Suggest.SuggestCommand.PrintResultsAndSummary.call/2
lib/credo/execution/task.ex:55: Credo.Execution.Task.do_run/3
(elixir 1.11.2) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
lib/credo/execution/task.ex:55: Credo.Execution.Task.do_run/3
(elixir 1.11.2) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
lib/credo.ex:30: Credo.run/1
So, I installed jason globally as well with mix archive.install hex jason
and ran the command again:
> /Users/pullrich/.asdf/shims/mix credo --format json --read-from-stdin --config-file .credo.exs --config-name default < ./lib/rollbar.ex
{
"issues": []
}
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 :)
from vscode-elixir-credo.
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.
from vscode-elixir-credo.
@hfjallemark elixir.credo.lintEverything
is a configuration option from this VS Code extension.
Normally, in order to respect the credo configuration's options for including and excluding file globs, 2 commands are executed:
- First,
mix credo info --format json --verbose
is executed, that returns an array of all files in the project directory that should be linted - If the current file is inside this allowlist, the command
mix credo --format json --read-from-stdin ...
is executed on the file's contents
The configuration option elixir.credo.lintEverything
bypasses this. Therefore, the command mix credo info
is never executed. And, therefore, the output channel should not including a line like Retreiving credo information: ...
, but the credo command directly. I think it would be very helpful if you tell me whether the command /Users/Hans/.asdf/shims/mix credo info --format json --verbose
returns sensible JSON output with a property config.files
that is an array of relative file paths.
from vscode-elixir-credo.
That seemed to work! Awesome, thanks ๐
from vscode-elixir-credo.
@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.
from vscode-elixir-credo.
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?
And could you run the following command in your terminal and send me the output?
/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 mix.exs
file exists. Maybe you have your mix.exs
file in a subdirectory or something?
from vscode-elixir-credo.
@pantajoe
It seems like the extension couldn't correctly identify the project root. When I removed all other projects from the workspace, it works fine now. It also works when my Elixir app is the 1st entry in the workspace.
from vscode-elixir-credo.
Okay, thanks for the update. I'll look into that to support multi-workspace scenarios.
from vscode-elixir-credo.
@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?
from vscode-elixir-credo.
@pantajoe Thank you!
from vscode-elixir-credo.
I'm still getting this error in 0.4.1:
Here's from the output:
> Retreiving credo information: Executing credo command `/Users/Hans/.asdf/shims/mix credo info --format json --verbose` for '/Users/Hans/Dev/app/lib/my_app/my_module.ex'
> Removing linter messages and cancel running linting processes for '/Users/Hans/Dev/app/lib/my_app/my_module.ex'.
> Command `/Users/Hans/.asdf/shims/mix credo` returns empty output! please check configuration. Did you add or modify your dependencies? You might need to run `mix deps.get` or recompile.
I've run both mix deps.get
and recompiled the app.
from vscode-elixir-credo.
Have you run mix credo
in your project directory and what is the output, @hfjallemark ?
from vscode-elixir-credo.
Yes here's the output:
$ย mix credo
Checking 306 source files (this might take a while) ...
...
Analysis took 1.9 seconds (0.2s to load, 1.7s running 53 checks on 306 files)
1245 mods/funs, found 2 warnings, 10 refactoring opportunities, 1 code readability issue.
And running the command above:
$ /Users/Hans/.asdf/shims/mix credo --format json /Users/Hans/Dev/app/lib/my_app/my_module.ex
{
"issues": []
}
from vscode-elixir-credo.
And the problem still occurs? How do you have your project opened in vscode? As a saved workspace? As a folder?
from vscode-elixir-credo.
Yep still occurs. I've opened my project as a folder.
from vscode-elixir-credo.
Hmm, could you activate the configuration option elixir.credo.lintEverything
and try again and get back to me whether it works or not?
from vscode-elixir-credo.
Where? In .credo.exs
or VS Code settings?
from vscode-elixir-credo.
In VS Code settings
from vscode-elixir-credo.
Great! @hfjallemark Could you maybe send me the output of your command /Users/Hans/.asdf/shims/mix credo info --format json --verbose
executed in your project directory please? It would be great, so I can maybe pin-point the problem then. ๐
from vscode-elixir-credo.
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"
}
}
from vscode-elixir-credo.
@hfjallemark Thanks a lot! It does look correct, though.
from vscode-elixir-credo.
@hfjallemark One more question:
I just released a new version with improved error reporting. In order to debug this error you had, I would be very grateful if you could download this new version in vs code, enable the extension's debug mode by setting "elixir.credo.enableDebug"
to true
, and show me the output of the extension's output channel when you have the configuration option "elixir.credo.lintEverything"
disabled.
from vscode-elixir-credo.
Looks like I'm getting a different error now:
> Retreiving credo information: Executing credo command `/Users/Hans/.asdf/shims/mix credo info --format json --verbose` for '/Users/Hans/Dev/app/lib/my_app/my_module.ex' in directory '/Users/Hans/Dev/app'
> Warning: "** (exit) exited in: GenServer.call(Mix.ProjectStack, {:get_stack, #Function<10.84060762/1 in Mix.ProjectStack.peek/0>}, :infinity)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
(elixir 1.11.2) lib/gen_server.ex:1017: GenServer.call/3
(mix 1.11.2) lib/mix/project.ex:196: Mix.Project.config/0
(mix 1.11.2) lib/mix/project.ex:378: Mix.Project.deps_path/0
(mix 1.11.2) lib/mix/dep/loader.ex:181: Mix.Dep.Loader.with_scm_and_app/4
(mix 1.11.2) lib/mix/dep/loader.ex:147: Mix.Dep.Loader.to_dep/3
(elixir 1.11.2) lib/enum.ex:1399: Enum."-map/2-lists^map/1-0-"/2
(mix 1.11.2) lib/mix/dep/loader.ex:333: Mix.Dep.Loader.mix_dep/2
(mix 1.11.2) lib/mix/dep/loader.ex:101: Mix.Dep.Loader.load/2
"
> Error on parsing output (It might be non-JSON output): " 07:27:08.987 [info] SIGTERM received - shutting down "
from vscode-elixir-credo.
In addition to the error above I'm also getting:
> Command `/Users/Hans/.asdf/shims/mix credo` returns empty output! Please check your configuration. Did you add or modify your dependencies? You might need to run `mix deps.get` or recompile.
from vscode-elixir-credo.
Hm, this is definitely weird. /Users/Hans/.asdf/shims/mix credo info --format json --verbose
still does not produce any error when run in the directory /Users/Hans/Dev/app
? Do you maybe have a repo with the project?
from vscode-elixir-credo.
First of all thanks for this extension. I have the same error: this is the output of mix credo info --format json --verbose
.
Seems that I have the error only on .exs files
{
"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.ModuleDoc",
"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/config/config.ex",
"lib/hello/hello.handler.ex",
"lib/quote/quote.schema.ex",
"lib/quotes_reminder_bot.ex",
"lib/repo/repo.ex",
"lib/send_quotes/send_quotes.handler.ex",
"lib/state/state.ex",
"lib/state/state.type.ex",
"lib/user/user.schema.ex",
"test/quotes_reminder_bot_test.exs",
"test/test_helper.exs"
]
},
"system": {
"credo": "1.5.6",
"elixir": "1.12.0",
"erlang": "24"
}
}
from vscode-elixir-credo.
@gigitux What OS do you use? And what does the output channel show if you have the configuration option "elixir.credo.enableDebug"
enabled when the error is thrown?
from vscode-elixir-credo.
@gigitux What OS do you use? And what does the output channel show if you have the configuration option
"elixir.credo.enableDebug"
enabled when the error is thrown?
OSX 11.4
Warning
Warning: "** (exit) exited in: GenServer.call(Mix.State, {:get, {Map, :get, [:remote_converger, nil]}}, :infinity) ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started (elixir 1.12.0) lib/gen_server.ex:1014: GenServer.call/3 (mix 1.12.0) lib/mix/dep/converger.ex:73: anonymous fn/1 in Mix.Dep.Converger.all/4 (mix 1.12.0) lib/mix/dep/converger.ex:185: Mix.Dep.Converger.all/9 (mix 1.12.0) lib/mix/dep/converger.ex:201: Mix.Dep.Converger.all/9 (mix 1.12.0) lib/mix/dep/converger.ex:123: Mix.Dep.Converger.all/7 (mix 1.12.0) lib/mix/dep/converger.ex:72: Mix.Dep.Converger.all/4 (mix 1.12.0) lib/mix/dep/converger.ex:51: Mix.Dep.Converger.converge/4 (mix 1.12.0) lib/mix/dep.ex:193: Mix.Dep.converge/1 "
Error
Error on parsing output (It might be non-JSON output): " 12:39:53.717 [info] SIGTERM received - shutting down "
from vscode-elixir-credo.
@gigitux So weird. And if you set "elixir.credo.lintEverything": true
? Do you get the same error?
And regardless what you do and how many times you hit Cmd+Save on an opened Elixir document, does the same error occur?
from vscode-elixir-credo.
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 [email protected]:rrrene/bunt.git
cd bunt
mix archive.build
mix archive.install
cd -
git clone [email protected]:rrrene/credo.git
cd credo
mix deps.get
mix archive.build
mix archive.install
After this:
mix credo gen.config
in the project's root folder- Installed Jason with
mix archive.install hex jason
- Restart VSCodium
I no longer get the error mentioned in the title.
from vscode-elixir-credo.
One more thing I noticed. This problem could be related to .credo.exs
on project's root dir. I encountered the problem a second time with a different project.
On opening the project with VSCodium I got the error mentioned in the title. Then I tried to generate .credo.exs
with mix credo gen.config
. The error message stated that I had a syntax error in my config/dev.exs
file. That turned out to be a typo. After I fixed it, I managed to create .credo.exs
and the problem with the extension went away.
from vscode-elixir-credo.
@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? ๐
from vscode-elixir-credo.
@lvl3 Great, thank you. Very much appreciated!
from vscode-elixir-credo.
Steps to solve this problem locally are now in the README. Thanks again @lvl3!
from vscode-elixir-credo.
@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?
While I can configure User and Workspace settings I cannot do the same for opened folders in a workspace.
per/directory in workspace .json
file:
settings per directory are not shown in the UI:
Does not show on Workspace folder:
from vscode-elixir-credo.
@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?
from vscode-elixir-credo.
@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!
from vscode-elixir-credo.
Related Issues (20)
- Add support for mix credo diff HOT 4
- Add support for project subdirectories HOT 18
- ".credo.exs file does not exist. Ignoring..." (Windows 10) HOT 4
- Error mix credo returned empty output HOT 7
- Linter doesn't show anything in umbrella application on windows 10 HOT 12
- Credo.Check.Refactor.ModuleDependencies breaks analysis HOT 1
- After saving in vscode with this extension enabled, `recompile` in IEx session does not work HOT 2
- ".credo.exs file does not exist. Ignoring..." (warning) HOT 5
- Tag filter options HOT 3
- Doesn't find the right root folder on multi-apps projects HOT 2
- Add a option to only run credo if mix.exs exists HOT 2
- Add config option to disable notification prompts regarding error parsing output
- Can't work with credo v1.6.7 HOT 2
- Extension errors when CMD/CTRL+hovering symbols from other files HOT 1
- Add option to re-lint as a vscode command and not on save
- โ.credo.exs file does not existโ in Umbrella project
- โ.credo.exs file does not existโ in project located in sub directory
- Pass filename to `--read-from-stdin` option to fix `credo` inconsistency HOT 2
- Wrong errors reported in VSCode HOT 3
- Add support for multiple default .credo.exs locations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-elixir-credo.