Open mhanberg opened 1 year ago
@iautom8things I created a new issue.
Can you share your .credo.exs file?
Hey, thank you for this. It's actually the same config (and project) that John was working on, we're teammates 🤜 🤛
%{
configs: [
%{
name: "default",
files: %{
included: ["lib/", "test/", "config/"],
excluded: []
},
checks: [
{Credo.Check.Refactor.Nesting, max_nesting: 3},
{Credo.Check.Refactor.Apply, false},
{Credo.Check.Refactor.MapInto, false},
{Credo.Check.Warning.LazyLogging, false},
{Credo.Check.Design.TagTODO, exit_status: 0}
]
}
]
}
And I just confirmed with @barkerj that the same thing is true for him: if we don't include the excluded: [ ~r"/_build/", ~r"/deps/" ]
we get the timeout error
ahh gotcha, i'll double check tonight if i can reproduce.
credo-language-server uses these command line flags under the hood ["--strict", "--all", "--working-dir", dir]
, with dir
being the root of your project.
you might check if mix credo --strict --all --working-dir .
works with your config
It seems like "./"
is somehow being added to the list of included:
dirs. I thought I had found something with how credo-language-server calls credo (what you just mentioned) but the --working-dir
flag does not seem to cause the behavior of credo taking a long time to run. I can, however, make it take about a minute by explicitly adding "./"
to the included:
list. That credo run looks like this:
Which if this is somehow happening by default via the language server, then it makes sense why explicitly excluding the deps/
folder would appear to fix our problem.
Though, I haven't figured out why credo would be trying to search the top level of the repo when called by credo-language-server.
so technically the ls is doing dir = /absolute/path/to/your/project
, could you try that instead of the dot .
?
That still seems to work as expected (it runs in < 3 seconds)
Can you try running iex iex -S mix run --no-start
and then doing Application.ensure_all_started(:credo)
and ["--strict", "--all", "--working-dir", File.cwd!()] |> Credo.run()
and then see what the included_dirs field is
With .credo.exs
excluded
config left empty, and running your suggested code:
iex(4)> ["--strict", "--all", "--working-dir", File.cwd!()] |> Credo.run() |> Map.get(:files)
%{
excluded: [],
included: ["lib/**/*.{ex,exs}", "test/**/*.{ex,exs}", "config/**/*.{ex,exs}"]
}
Sorry, lost track of the state of this.
This issue still needs action, correct?
I'm having the same issue that @barkerja was having but the solution that worked for him does not appear to work for me.
I'll try to list out all applicable versions:
1.79.2
elixir-tools.vscode
:v0.2.2
24.3.4.8
1.14.2-otp-24
1.6.4
and1.7.0
I've tried blowing away
.elixir-tools
,_build
anddeps
,mix local.hex --force
andmix local.rebar --force
,mix deps.get
and restarting vscode but it yields the same issue.Also, I may very well be mistaken but it doesn't seem like using the
excluded
field to exclode_build
anddeps
even though those folders weren't included should do anything.This yields the same result for me.
Originally posted by @iautom8things in https://github.com/elixir-tools/credo-language-server/issues/67#issuecomment-1609768926