Code Monkey home page Code Monkey logo

Comments (14)

gosukiwi avatar gosukiwi commented on July 24, 2024 1

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.

vzamanillo avatar vzamanillo commented on July 24, 2024

What about running Rubocop against the same file from console? Same results?

from linter-rubocop.

gosukiwi avatar gosukiwi commented on July 24, 2024

From console it works as expected.

from linter-rubocop.

vzamanillo avatar vzamanillo commented on July 24, 2024

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.

vzamanillo avatar vzamanillo commented on July 24, 2024

I found it, 07c3453, it says Rubocop warns about filenames without underscores and with numbers or symbols it this your case?

from linter-rubocop.

gosukiwi avatar gosukiwi commented on July 24, 2024

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:

sc

from linter-rubocop.

vzamanillo avatar vzamanillo commented on July 24, 2024

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.

gosukiwi avatar gosukiwi commented on July 24, 2024

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.

vzamanillo avatar vzamanillo commented on July 24, 2024

Thanks for the info, could you please attach the linter-rubocop configuration?

from linter-rubocop.

gosukiwi avatar gosukiwi commented on July 24, 2024

Here's my config:

sc

from linter-rubocop.

vzamanillo avatar vzamanillo commented on July 24, 2024

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.

gosukiwi avatar gosukiwi commented on July 24, 2024

Thanks for all your work and help @vzamanillo, I suspect it has something to do with WSL :/

from linter-rubocop.

vzamanillo avatar vzamanillo commented on July 24, 2024

Thank you for reporting the issue. It could be, it is the only and unusual "strange agent".

from linter-rubocop.

vzamanillo avatar vzamanillo commented on July 24, 2024

Good catch! Thank you for the info and the workaround.

from linter-rubocop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.