Skip to content
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

timing out (another one) #73

Open
mhanberg opened this issue Jun 27, 2023 · 9 comments
Open

timing out (another one) #73

mhanberg opened this issue Jun 27, 2023 · 9 comments
Labels
bug Something isn't working needs-repro Needs a minimal reproduction

Comments

@mhanberg
Copy link
Contributor

          Hi, my apologies for commenting on a closed issue!  And thank you for all of your work on this project!

I'm having the same issue that @barkerja was having but the solution that worked for him does not appear to work for me.

[Error - 10:37:20 AM] Stopping server failed
Error: Stopping the server timed out
	at /Users/mz/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/dist/extension.js:2:150423
[Error - 10:37:20 AM] Stopping server failed
Error: Stopping the server timed out
	at /Users/mz/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/dist/extension.js:2:150423
[Error - 10:37:20 AM] Stopping server failed
Error: Stopping the server timed out
	at /Users/mz/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/dist/extension.js:2:150423
[Error - 10:37:20 AM] Client Credo: connection to server is erroring. Shutting down server.

I'll try to list out all applicable versions:

  • vscode: 1.79.2
  • elixir-tools.vscode: v0.2.2
  • erlang: 24.3.4.8
  • elixir: 1.14.2-otp-24
  • credo: 1.6.4 and 1.7.0

I've tried blowing away .elixir-tools, _build and deps, mix local.hex --force and mix 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 and deps even though those folders weren't included should do anything.

Mix.install([:credo])

defmodule Test do
  def run do
    not_excluded_config = %Credo.Execution{
      cli_options: %Credo.CLI.Options{path: "."},
      files: %{
        included: ["lib/", "test/", "config/"],
        excluded: []
      }
    }

    excluded_config = %Credo.Execution{
      cli_options: %Credo.CLI.Options{path: "."},
      files: %{
        included: ["lib/", "test/", "config/"],
        excluded: [
          ~r"/_build/",
          ~r"/deps/"
        ]
      }
    }

    excluded_count = excluded_config |> Credo.Sources.find() |> Enum.count()
    not_excluded_count = not_excluded_config |> Credo.Sources.find() |> Enum.count()
    IO.puts("excluded count: #{excluded_count}\nnot excluded count: #{not_excluded_count}")
  end
end

Test.run()

This yields the same result for me.

Originally posted by @iautom8things in #67 (comment)

@mhanberg
Copy link
Contributor Author

@iautom8things I created a new issue.

Can you share your .credo.exs file?

@mhanberg mhanberg added bug Something isn't working needs-repro Needs a minimal reproduction labels Jun 27, 2023
@iautom8things
Copy link
Contributor

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

@mhanberg
Copy link
Contributor Author

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

@iautom8things
Copy link
Contributor

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:

Screenshot 2023-06-27 at 1 47 06 PM

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.

@mhanberg
Copy link
Contributor Author

so technically the ls is doing dir = /absolute/path/to/your/project, could you try that instead of the dot . ?

@iautom8things
Copy link
Contributor

image
That still seems to work as expected (it runs in < 3 seconds)

@mhanberg
Copy link
Contributor Author

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

@barkerja
Copy link

barkerja commented Jun 28, 2023

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}"]
}

@mhanberg
Copy link
Contributor Author

Sorry, lost track of the state of this.

This issue still needs action, correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-repro Needs a minimal reproduction
Projects
None yet
Development

No branches or pull requests

3 participants