-
Notifications
You must be signed in to change notification settings - Fork 286
.rubocop.yml exclude doesn't work. #227
Comments
I don't have any experience with Windows 10. But, I am guessing the below config (in user settings) will solve your problem.
|
I can't because today is not possible: #133 |
But anyway other settings in my |
Hi @johnunclesam Is this still an issue for you with the latest version of the extension? Some changes were introduced in how Rubocop is run in v0.16.0 so wondering if that fixed it. |
I personally still have this problem and I'm using version 0.17.0 on macOS. |
Still a problem for me, v0.17.0 with rubocop v0.53.0 on macOS. |
Still a problem. |
Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience. |
Yep still a problem. |
I bet rubocop doesn't apply |
I just ran Rubocop on a single file, and it respected exclusions. Specifically, certain rules by default in Rubocop, don't apply to files in |
@garyking, there are two separate issues:
|
@garyking what's your rubocop config for this extension look like? Both of those issues basically mean Rubocop is either not finding the |
This ext isn't importing Excludes from inherited rules for some reason. I have a workspace in VSC. There's a In that inherited file, it has: Metrics/ClassLength:
Exclude:
- 'test/**/*'
Max: 150 Back in my workspace, in the file |
I am planning to investigate this and other linting issues, see #317 (comment). Probably need a new tracking issue for that once @wingrunr21 chimes in. |
Changing: inherit_from: .rubocop_todo.yml to inherit_from: ~/.rubocop_todo.yml fixed the issue in VS Code. But it breaks running on command line through CLI. |
exclude in .rubocop.yml (and .rubocop_todo.yml ) when using vs code formatting on save still doesn't work. Has someone found a workaround ? |
It will be fixed soon |
Any news on this? |
The language server support for RuboCop should support the whole config file |
I am still getting warnings in files that I have specifically excluded on my |
I'll chime in and say that the AllCops ignore doesn't seem to have any effect, but other settings in the |
The |
Same here, not cool at all. |
Yup, still an issue with a config file that inherits from other files... |
Can I get some more examples of RuboCop configs? I'm wondering if this is a confluence of three things:
Note that other than how the language server invokes RuboCop, there's little that I can do here. I need to be able to invoke RuboCop consistently and have it give me an appropriate response in whatever circumstance. This is why I think there's some kind of mismatch between how everyone's configuring their linters and how RuboCop is being invoked. |
This issue was closed so I explained my findings in #566 (comment) TL;DR
|
I get this issue too. It's wonderful most of the time but in those 1% of files where it's not folloing the .yml it becomes a pain and I can't format on save |
👋 I'm running into this as well!
inherit_gem:
rubocop-shopify: rubocop.yml
AllCops:
TargetRubyVersion: 2.5
Exclude:
- 'spec/**/*'
- 'db/migrate/**/*'
|
Still doesn't work for me (v0.28.1). Even with Non-working rule:
Run log:
Error sown in editor: |
Yep, stopped working for me again, even with |
In my .rubocop.yml I have this
And in my VScode settings Json I have this
it still shows the |
I happened to notice something regarding this. The |
The |
The |
I had the same problem but noticed that when it was run in Visual Studio, Rubocop wasn't referencing the same root directory as my project. So I tried making the exclusion root-independent and it then worked fine: # Doesn't work :(
AllCops:
Exclude:
- db/schema.rb # Works :)
AllCops:
Exclude:
- */schema.rb |
@peternixey I tried your solution and works in vs code but then it does not work in the command line. When I tried to run in the terminal /path/to/your/project/.rubocop.yml): did not find expected alphabetic or numeric character while scanning an alias at line 5 column 7
/path/to/your/home/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych.rb:456:in `parse'
/path/to/your/home/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych.rb:456:in `parse_stream'
/path/to/your/home/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych.rb:390:in `parse'
... This helps while developing with VS code but if you have |
@heragu - it actually doesn’t even work in Vscode any more for me. I find anything to do with Ruby (solargraph etc too) a bit of a black art to get working! |
The |
This behavior is really strange. I created experiment project: https://github.com/shrkw/vscode-ruby-dev-env-sample , and rubocop and "Exclude" settings works very well yesterday. Debug Output view for "Ruby Language Server" shows rubocop has correct option...
and same command returns no offenses.
It's really difficult to understand. |
I found what caused the problem, it's this setting:
I removed it and it worked! It should be |
@benzado if I am not mistaken PR #720 fixes only |
Even if PR #825 gets merged and doesn't work, we're no worse off than we are right now with 0.28.1. Could #641 even be reproduced at this point, given the 78 (I counted) releases rubocop has had since August 01, 2020? Rather than dealing with the fallout of that commit for 2 more years, can PR #647 just be reverted until it can be shown that there actually is a problem in the first place? |
You should really also document the pattern syntax. Whether it's a |
Your environment
vscode-ruby
version: 0.15.0Expected behavior
.rubocop.yml
like this should work:Actual behavior
db/schema.rb
andGemfile
being rubocopped.Via
rubocop db
it works. So, it's a bug?The text was updated successfully, but these errors were encountered: