-
Notifications
You must be signed in to change notification settings - Fork 286
Linters run from file's directory, not from workspace root #717
Comments
Closing due to linking against #719 |
@wingrunr21 I don't think this issue should be closed. This issue isn't the cause of the Rubocop problem, but it's still wrong behavior that contradicts the documentation. |
@wingrunr21 Could I ask your attention for the previous comment? Do you agree or disagree? |
What behavior are you seeing around this? c1b87d3 was the original commit that implemented this behavior as people were submitting reports that when RuboCop configs were NOT in the workspace root RuboCop was not finding those configurations due to the |
@wingrunr21 Okay, that sounds like a good reason. But if the intention is to run Rubocop from the file's directory instead of the workspace root, then the docs should not say that linters will be run from the workspace root. |
I created a new pull request that fixes the docs to match actual behavior. See above. |
This issue has not had activity for 30 days. It will be automatically closed in 7 days. |
Please don't auto-close this issue. It's awaiting review. |
This issue has not had activity for 30 days. It will be automatically closed in 7 days. |
Please don't auto-close this issue. It's awaiting review. |
I'm working on a project that has I would guess that finding the appropriate configuration for |
@tschaub the behavior you are seeing is due to how I think the solution here is to add a configuration option that allows people to specify where a linter is executed. Either at |
This issue has not had activity for 30 days. It will be automatically closed in 7 days. |
Actual. |
This issue has not had activity for 30 days. It will be automatically closed in 7 days. |
Heh, GitHub actions isn't so good at math. It's been a lot more than 30 days since the last activity. Well, it's still a problem, so let's keep it open... |
Your environment
vscode-ruby
version: 0.28.1, and also commit 7b5b602useLanguageServer
is true in your configuration?) yesExpected behavior
Linters such as Rubocop are run with a current working directory equal to the workspace root.
Actual behavior
Linters such as Rubocop are run with a current working directory equal to that of the open file.
To reproduce:
Create a shell script
~/fake-rubocop
that prints the current working directory as well as executes Rubocop:Make sure to chmod +x the script.
Use this configuration:
Open a Ruby project directory. Inside that project directory, open a Ruby file that's not in the workspace root (e.g.
lib/foo.rb
).In the Ruby Language Server output, observe that
fake-rubocop
logs "/path-to-workspace/lib" as current working directory, instead of "/path-to-workspace".Comments
The troubleshooting document clearly says that this is not the expected behavior:
However, if we look at packages/language-server-ruby/src/Linter.ts, then we see:
This executionRoot is then used to set the current working directory when executing linters. In packages/language-server-ruby/src/linters/BaseLinter.ts:
The code clearly contradicts the documented behavior.
I believe that this bug is the cause of problems like #227. Rubocop only looks for .rubocop.yml in the current working directory.Update: #719 has been identified as the true cause of #227.The text was updated successfully, but these errors were encountered: