In auto-correct mode, RuboCop will try to automatically fix offenses:

$ rubocop -a

For some offenses, it is not possible to implement automatic correction.

Some automatic corrections that are possible have not been implemented yet.

Safe auto-correct

$ rubocop --safe-auto-correct

In RuboCop 0.60, we began to annotate cops as Safe or not safe.

  • Safe (true/false) - indicates whether the cop can yield false positives (by design) or not.
  • SafeAutoCorrect (true/false) - indicates whether the auto-correct the cop does is safe (equivalent) by design.

If a cop is annotated as "not safe", it will be omitted. As of December, not all cops have a Safe annotation.