-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
RSpec/FilePath is broken with vscode-ruby after 1.39.0 (2020-05-01) #1091
Comments
@ahukkanen Thanks for reporting, nice catch.
Let's check if specs fail. If they do not - a pull request is welcome. |
@pirj Actually it breaks that test which was added in that commit linked above. It tests that this fails:
This matches that file path because:
This is incorrect match because the file name should be "foo_spec.rb". |
The spec shouldn't break, as it expected to be detected that it's an incorrect match ( |
@pirj Yes, it's not trivial. The glob pattern and matching flags need to be changed. Would do PR if I knew how. Right now I don't know how. |
For sure, I don't have a solution ready off the top of my head. But you can do it. Start with a spec that will pass for your case. You're in the best position to fix this, as nobody is going to fix it for you. |
Yeah, I can personally live with it for now, just forking that one line locally - works for me. I tried to fix it but it's quite complicated, would need to find the proper time for it. |
Do you mind closing this if this is a non-issue for you? |
No, I don't mind if you feel it's not a bug. At least it's kept here fore the records as other people have reported it for VSCode. |
I feel it's a bug, but I also feel it will never be fixed unless someone wants to scratch their own itch. To make sure it's eventually fixed I suggest you send a pull request with a pending failing spec. We are volunteers, and, unfortunately, we can't guarantee feature completeness, correctness or freedom from bugs considering a rich choice of use cases. Let's take a look at just a few recent tickets:
As you may have already guessed, those are nastier bugs, and they will be addressed earlier. And still we motivate reporters to dive into our codebase and contribute fixes. You may find tickets dating back to 2016, and that means that nobody cared enough to apply the effort to address them. Given some work/life balance that is tilted already for most open-source software maintainers, and time constraints, this bug will very doubtfully be a priority anytime soon, and very unlikely to be fixed by maintainers themselves. I really insist on sending a pull request with a pending spec. We have just one pending spec so far, and I personally hate them. Chances are I'll be in the mood to fix minor offences in a bulk, but again, no guarantees, as some cops, e.g. Thanks for understanding. |
Yeah of course, I totally understand. It's just important to have it documented somewhere, as figuring out the root cause is already half the work. I might also fix it at some point, I just don't have the time right now to investigate further. Also for me, it's not that big of a deal right now as I can live with the forked version. If I will send a PR, I'd like to have incorporated a fix as well. Thanks for your great work! |
Fix false positive for relative file path runs with long namespaces (fixes #1091)
I've been trying to figure out what's the current status of this issue for a while now by reading issues here and there. The same problem happens to me right now with the latest version of everything. |
Looks like |
I just ran into this using |
Have you uninstalled vscode-ruby? |
Yep, I have, thanks for the suggestion. I'm only seeing it in one file, and copying the same file in another project doesn't show the same issue, so it might just be a weird thing with my setup? Unless more people say they're also still experiencing this, might not be worth checking out |
Details:
Related issue with vscode-ruby:
rubyide/vscode-ruby#625
The RSpec/FilePath cop does not work with vscode-ruby.
It causes issues such as this one (originating from decidim/decidim#6857):
Why this happens is that vscode-ruby runs rubocop inside the folder where the file exists. So, in the example case shown in the screenshot it does the following:
I was debugging vscode-ruby to find the root cause but I figured it was this commit in rubocop-rspec that has broken the functionality:
811ae08#diff-5b709885b35566a0c699ad4a3200b9b7acbc28ef640fa56a8e66f6c732420a34
Is there some reasoning behind this change or should vscode-ruby change the way it runs the linter?
This could be fixed for vscode-ruby by changing the following lines in rubocop-rspec:
https://github.com/rubocop-hq/rubocop-rspec/blob/78f94bb3216fa2a6f27a43af47728762caabde89/lib/rubocop/cop/rspec/file_path.rb#L135-L137
To:
But maybe this would possibly reintroduce the problems that 811ae08 fixed?
It is hard to make the judgement where the actual bug is without knowing some insight about this change. I don't understand why it has been made.
The text was updated successfully, but these errors were encountered: