Skip to content
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

.spec pattern clashes with RPM spec files #4553

Closed
iainbeeston opened this issue Jun 27, 2017 · 2 comments
Closed

.spec pattern clashes with RPM spec files #4553

iainbeeston opened this issue Jun 27, 2017 · 2 comments

Comments

@iainbeeston
Copy link
Contributor

iainbeeston commented Jun 27, 2017

Expected behavior

I'd expect rubocop to only parse ruby files, and ignore any files that are not ruby files.

Actual behavior

Rubocop is trying to parse ".spec" files in my project's node_modules directory, which are rpm spec files, not ruby files, and it throws an error because it cannot parse them.

Steps to reproduce the problem

I've added a sample rails app that reproduces the issue here, which has a travis build to show the issue here

To reproduce manually:

  1. rails new --webpack=react foo
  2. cd foo
  3. Add rubocop to Gemfile
  4. bundle install
  5. bundle exec rake yarn:install
  6. rubocop

RuboCop version

$ rubocop -V
0.49.1 (using Parser 2.4.0.0, running on ruby 2.4.1 x86_64-darwin16)
@iainbeeston
Copy link
Contributor Author

iainbeeston commented Jun 27, 2017

I can see that by default rubocop loads .spec files in config/default.yml.

However, I suspect that the correct way to fix this would to be ignore node_modules/**/* by default. Especially as it's a standard directory now in rails 5.1?

@Drenmi
Copy link
Collaborator

Drenmi commented Jun 28, 2017

RuboCop tries to make as few library specific exceptions as possible, since it is a Ruby analyzer. That said, having a node_modules in the same directory is not really library specific, and I personally (I'm not a maintainer) wouldn't be opposed to having this ignored by default. (The chance of someone having a directory, node_modules, with Ruby code is practically 0.) 🙂

Care to make a PR to have it tested? 🙂

iainbeeston added a commit to iainbeeston/rubocop that referenced this issue Jun 29, 2017
New Rails 5.1 projects include a `node_modules` directory, which
contains vendored code (just like the `vendor` directory) and should
not be checked by rubocop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants