Ben Wiseley
Ben Wiseley

Reputation: 547

How do you configure Rubocop to display rule when running

It seems like, instead of the SUPER helpful Offense/Concern/Warning sytax like:

C: Use delete instead of gsub.

It could display:

C: Use delete instead of gsub. Cop name: [Whatever it's upset about]

So you could disable the thing without another hour of googling the ungooglable.

I've googled this for a while now and have yet to find the answer in the 4,200 questions this excellent linter has generated.

Upvotes: 0

Views: 258

Answers (2)

Drenmi
Drenmi

Reputation: 8777

To display the cop name in the output, you can use --display-cop-names, or -D for short.

Example:

$ bundle exec rubocop -D tmp.rb
Inspecting 1 file
C

Offenses:

tmp.rb:1:6: C: Style/MethodCallParentheses: Do not use parentheses for method calls with no arguments.
hello()
     ^

Upvotes: 2

Ben Wiseley
Ben Wiseley

Reputation: 547

be rubocop --dedbug

That sort of does it... you can toss a file name in there as well

be rubocop app/models/ihaterubocop.rb --dedbug

Upvotes: -1

Related Questions