简体   繁体   中英

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.

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()
     ^
be rubocop --dedbug

就是这样...您也可以在其中扔一个文件名

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM