$ gem install rubocop
- usage $ rubocop #=> bunch of errors (1000's maybe)
Strategy:
- permit everything
- fix incrementally
$ rubocop --auto-gen-config
-
creates '.rubocop_todo.yml' (the permit everything file)
-
now add rubocop to CI
- comment out rule from '.rubocop_todo.yml'
- fix it => commit
-
prefering double quoted strings always rule: Style/StringLiterals
-
use file to find config option
https://github.com/bbatsov/rubocop/blob/master/config/default.yml
-
slow with large files, very slow with very large files
$ rubocop
gets stuck -
see where rubocop gets stuck with
$ rubocop -f fuubar
-
rubocop useful reports other than line length and single/double quotes:
- do not start setter methods with
set_method
, usemethod=
Hash#has_key?
is deprectead, useHash#key?
- do not start setter methods with