Comments (14)
Just so we can close this, I found the issue. Basically, when using WSL, I was sending Windows line endings to Rubocop, which get escaped, so instead of, for example: C:\Users\my_file.rb
, Rubocop was getting C:Usersmy_file.rb
.
I fixed it by creating a rubocop.cmd
file in my PATH to wrap the command, and escape backward slashes to forward slashes:
@echo off
REM Transform backward slashes (\) to UNIX forward slashes (/) for all arguments
set "args=%*"
set "args=%args:\=/%"
wsl /home/myusername/.rvm/gems/ruby-2.6.6/wrappers/rubocop %args%
Now it works and I don't even have to customize the settings, as it's using the default executable name :)
from linter-rubocop.
What about running Rubocop against the same file from console? Same results?
from linter-rubocop.
From console it works as expected.
from linter-rubocop.
Could you please paste the complete offense message? I can remember I had this issue in the past with the tests but I can't remember how I resolved it.
from linter-rubocop.
I found it, 07c3453, it says Rubocop warns about filenames without underscores and with numbers or symbols
it this your case?
from linter-rubocop.
Thanks for your help @vzamanillo. I tried it with two files: lib\rubisp\tokenizer\matchers\number.rb
and spec\rubisp\tokenizer\matchers\number_spec.rb
. It complains about both of them.
I attach an image:
from linter-rubocop.
You are welcome.
Are you sure you are running the same Rubocop version from Atom and from console? could you please check the two versions running
wsl /home/<my-user>/.rvm/gems/ruby-2.6.6/wrappers/rubocop -V
$(which rubocop) -V
(outside any gemset, from system default rvm)
please?
Do you have any custom Rubocop configuration via .rubocop.yml
in the project folder?
Does include the project gemfile the rubocop gem and it is in the bundle? check it with
gem list rubocop
(from project folder)
I can't reproduce your issue but I am working in another environment, that's is the reason of the above questions.
from linter-rubocop.
It surely is running the same version:
# On the Windows side
PS C:\Users\MyUser> wsl /home/<my-user>/.rvm/gems/ruby-2.6.6/wrappers/rubocop -V
0.84.0 (using Parser 2.7.1.2, rubocop-ast 0.0.3, running on ruby 2.6.6 x86_64-linux)
# On the Linux side using WSL 1
/mnt/c/Users/MyUser » $(which rubocop) -V
0.84.0 (using Parser 2.7.1.2, rubocop-ast 0.0.3, running on ruby 2.6.6 x86_64-linux)
I have a rubocop configuration file at the root of my project but it's quite minimal:
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Style/LambdaCall:
EnforcedStyle: braces
Style/Documentation:
Enabled: false
Layout/LineLength:
Max: 120
Metrics/BlockLength:
Enabled: true
Exclude:
- spec/**/*
I don't have rubocop
in my Gemfile but I did install it using gem install
. Running gem list rubocop
in my project root I get:
/mnt/c/Users/MyUser/Workspace/rubisp(master*) » gem list rubocop
*** LOCAL GEMS ***
rubocop (0.84.0)
rubocop-ast (0.0.3)
from linter-rubocop.
Thanks for the info, could you please attach the linter-rubocop
configuration?
from linter-rubocop.
Here's my config:
from linter-rubocop.
I am not able to reproduce your issue and I can not imagine what could cause it :/ (yet) sorry. I will try to reproduce your environment on a Windows virtual machine, I will keep you informed.
from linter-rubocop.
Thanks for all your work and help @vzamanillo, I suspect it has something to do with WSL :/
from linter-rubocop.
Thank you for reporting the issue. It could be, it is the only and unusual "strange agent".
from linter-rubocop.
Good catch! Thank you for the info and the workaround.
from linter-rubocop.
Related Issues (20)
- switching on --autocorrect HOT 1
- Performance Cops will be removed from RuboCop 0.68 HOT 17
- chruby - Unable to parse rubocop version from command output: .0.67.2 (note leading dot) HOT 2
- Minimum Atom version too low HOT 10
- No rule doc available HOT 1
- Avoid opening error popups when rubocop is not found HOT 14
- Rubocop 0.72.0 changes documentation URL breaking specs HOT 2
- Error running RuboCop - Layout errors HOT 18
- Exclude flag not respected HOT 2
- CI is broken after Rubocop release 0.76 HOT 1
- Cannot read property 'stdout' of null HOT 5
- Use `bundler` to execute Rubocop configuration option does not check if bundler exists HOT 1
- Opiton to disable popup messages for the current line HOT 1
- Linter shows formatted offense documentation HOT 1
- Project-specific commands HOT 1
- Unnecessary running lint on .erb HOT 1
- Action Required: Fix Renovate Configuration
- Support for Command Substitution HOT 2
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linter-rubocop.