-
Notifications
You must be signed in to change notification settings - Fork 285
Wrong file path passed to RuboCop and Reek #719
Comments
This change was introduced in #647 by @coneybeare. @coneybeare would you be able to provide your insight here? |
ok. @coneybeare if you don't have any comments here it sounds like #647 caused a regression that I'd like to correct. Absent input to the contrary I'll likely merge #720 Giving this through the end of this week then I'll be merging. |
oh hm, I actually did comment, not sure where it went. Here was the original issue that prompted my PR. Despite OPs assertion that As long as the proposed fix doesn't introduce a regression for what I fixed, I am onboard. |
Any updates? |
I plan on looking into the issue #641 that @coneybeare referenced. I just haven't had time so far. |
@coneybeare I've tested #641. Just like you, I'm on macOS. I've confirmed that my PR #720 has no problems with spaces in filenames. Test setup
Test steps
Expected behavior
Actual behaviorMatches expected behavior. |
This issue has not had activity for 30 days. It will be automatically closed in 7 days. |
Please don't auto-close this PR. 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. |
This issue has not had activity for 30 days. It will be automatically closed in 7 days. |
Ping
…On Sat, Sep 25, 2021, 5:41 PM github-actions[bot] ***@***.***> wrote:
This issue has not had activity for 30 days. It will be automatically
closed in 7 days.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#719 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APRKQYUQYRZCDAWBNLT5DGTUDZT47ANCNFSM4ZZLQG2Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Your environment
vscode-ruby
version: 0.28.1, and also commit 7b5b602useLanguageServer
is true in your configuration?) yesExpected behavior
RuboCop is run with these arguments:
Reek is run with these arguments:
Actual behavior
RuboCop is run with these arguments:
Reek is run with these arguments:
To reproduce:
Create a shell script
~/fake-rubocop
that prints the exact arguments passed:Make sure to chmod +x it.
Create a shell script
~/fake-reek
that prints the exact arguments passed:Make sure to chmod +x it.
Use this configuration:
Open a Ruby project directory. Inside that project directory, open a random Ruby file.
In the Ruby Language Server output, observe that
fake-rubocop
logs this:We expect no extraneous quotes:
In the Ruby Language Server output, observe that
fake-reek
logs this:We expect no extraneous quotes:
Comments
Because of the extraneous quotes, we pass invalid filenames to RuboCop and Reek.
I don't know whether this causes problems for Reek, but it does cause problems for RuboCop: see #227. Normally, RuboCop checks each level of parent directory in the input file's path, in search for a .rubocop.yml. But because we pass an invalid filename, RuboCop can't find a .rubocop.yml, and ends up ignoring the .rubocop.yml that the project has.
The extraneous quotes are deliberately inserted by the code:
In packages/language-server-ruby/src/linters/RuboCop.ts:
In packages/language-server-ruby/src/linters/Reek.ts:
I suspect that the author meant to prevent any issues with spaces in filenames. However, Linters are executed through cross-spawn, which doesn't execute commands through a shell. There should be no problems with spaces in filenames: each element in the argument array represents exactly one argument, with no shell trying to split up filenames by space.
The text was updated successfully, but these errors were encountered: