Rubocop-rspec: Various cops crash when .rubocop.yml is missing

Created on 12 Jun 2018  Ā·  14Comments  Ā·  Source: rubocop-hq/rubocop-rspec

Steps to reproduce:

git clone https://github.com/mensfeld/broken-rubocop-rspec3
cd broken-rubocop-rspec3
./run.sh

Output:

Using ast 2.4.0
Using bundler 1.16.2
Using jaro_winkler 1.5.1
Using parallel 1.12.1
Using parser 2.5.1.0
Using powerpack 0.1.2
Using rainbow 3.0.0
Using ruby-progressbar 1.9.0
Using unicode-display_width 1.4.0
Using rubocop 0.57.2
Using rubocop-rspec 1.26.0
Bundle complete! 2 Gemfile dependencies, 11 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Inspecting 2 files
.An error occurred while RSpec/DescribedClass cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/OverwritingSetup cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ItBehavesLike cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ItBehavesLike cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ItBehavesLike cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/NotToNot cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/NotToNot cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/NotToNot cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
An error occurred while RSpec/ExampleLength cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
To see the complete backtrace run rubocop -d.
C

Offenses:

spec/example_spec.rb:1:1: C: RSpec/FilePath: Spec path should end with anything*_spec.rb.
describe Anything do
^^^^^^^^^^^^^^^^^

2 files inspected, 1 offense detected

21 errors occurred:
An error occurred while RSpec/DescribedClass cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
An error occurred while RSpec/ExpectChange cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
An error occurred while RSpec/OverwritingSetup cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
An error occurred while RSpec/PredicateMatcher cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
An error occurred while RSpec/ItBehavesLike cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/ItBehavesLike cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
An error occurred while RSpec/ItBehavesLike cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
An error occurred while RSpec/NotToNot cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
An error occurred while RSpec/NotToNot cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:2:2.
An error occurred while RSpec/NotToNot cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
An error occurred while RSpec/ExampleLength cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:4:2.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues

It crashes when executed following way:

bundle exec rubocop --only RSpec --require rubocop-rspec
bug

Most helpful comment

I tried to reproduce this issue in various versions of RuboCop today, and it looks like it was fixed by https://github.com/rubocop-hq/rubocop/pull/7632 in RuboCop v0.82.0.

Please re-open if you are still running into this issue.

All 14 comments

Seems the same issue as in #613

@Darhazer not really. I mean I don't have a rubocop config and all of it relies on the default once. In case no pattern is present, shouldn't it just ignore this file?

@Darhazer as an update. With following config still fails (although less drastically):

require: rubocop-rspec

AllCops:
  Include:
    - spec/**/*_spec.rb
An error occurred while RSpec/OverwritingSetup cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
To see the complete backtrace run rubocop -d.
C

Offenses:

spec/example_spec.rb:1:1: C: RSpec/FilePath: Spec path should end with anything*_spec.rb.
describe Anything do
^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

1 error occurred:
An error occurred while RSpec/OverwritingSetup cop was inspecting /home/mencio/Pulpit/broken-rubocop-rspec3/spec/example_spec.rb:1:0.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues

Mention the following information in the issue report:
0.57.2 (using Parser 2.5.1.0, running on ruby 2.5.1 x86_64-linux)

Ah, I think that is the ā€œforgottenā€ issue from https://github.com/rubocop-hq/rubocop-rspec/issues/613#issuecomment-389777840

The ā€œnothing works when there is no .rubocop.yml fileā€ seems to have been present for a long, long time. Let’s leave that one for now.

Thanks for opening a new issue.

@bquorning as I said - when I have a small rubocop.yml with the config as followed:

require: rubocop-rspec

AllCops:
  Include:
    - spec/**/*_spec.rb

it also fails. Just less drastically (but still). Probably due to a space between let and the name:

let (:a) { 1 }

Again with reporting two bugs at the same time šŸ˜„

I’ll take a look at then both.

That issue is actually a duplicate of #624, which has a proposed fix in #625.

Again with reporting two bugs at the same time
Sorry ;) I run rubocop-rspec couple thousand of times for multiple projects automatically, so you can always ping me with a prerelease and we can give it a spin ;)

@mensfeld Looks like all the other issues have been fixed as of 1.27.0 (thanks for the great reproduction script!) but the missing .rubocop.yml issue persists, so I've updated the title.

@dgollahon any time. As I said, I run this stuff a lot for many codebases (hundreds) so always after upgrades I see many errors ;)

I run this stuff a lot for many codebases (hundreds)

Just curious, what causes you to run it for hundreds of codebases? Do you have that many projects that you oversee? Or is there some other supporting reason?

@dgollahon I run self-hosted service for analyzing ruby repos: https://coditsu.io/
You can check it out here: https://app.coditsu.io/karafka/commit_builds and for example results from rubocop rspec: https://app.coditsu.io/karafka/builds/validations/6ea37309-98f8-4d46-ae31-0b537db06b6a/offenses

This allows me to bump single instance of rubocop-rspec (as well as other tools) and rerun many analysis for all the projects, so there is no need to have anything apart from business and specs within repositories. Makes management much easier. I've built it after years of building simple scripts and tools for exactly that job.

@mensfeld neat šŸ‘

I tried to reproduce this issue in various versions of RuboCop today, and it looks like it was fixed by https://github.com/rubocop-hq/rubocop/pull/7632 in RuboCop v0.82.0.

Please re-open if you are still running into this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bgeuken picture bgeuken  Ā·  5Comments

bquorning picture bquorning  Ā·  8Comments

luizkowalski picture luizkowalski  Ā·  5Comments

ybiquitous picture ybiquitous  Ā·  7Comments

aried3r picture aried3r  Ā·  7Comments