Before you go, check out these stories!

Hackernoon logoPending Cops in Rubocop to Make Upgrade Easier [Project Update] by@prathamesh

Pending Cops in Rubocop to Make Upgrade Easier [Project Update]

Author profile picture


Whenever a new version of Rubocop comes out, there are always some new cops. If our code is not compatible with new cops, then the
build fails. With every new release, we have to spend time to make our code compatible with the new cops. Well not any more!

Starting Rubocop 0.79.0 onwards, new cops will be marked as pending. Rubocop will print a message listing the pending cops so that users know which cops are introduced in a release.

โžœ  codetriage git:(master) โœ— rubocop
The following cops were added to RuboCop, but are not configured. 
Please set Enabled to either `true` or `false` in your 
`.rubocop.yml` file:
 - Style/HashEachMethods
 - Style/HashTransformKeys
 - Style/HashTransformValues

Disabling all cops by default

Rubocop also provides a feature to disable all cops by default. This can be achieved as follows:

# .rubocop.yml

  DisabledByDefault: true

In this case, we need to explicitly enable selected cops that we want to use in our codebase.

# .rubocop.yml

  DisabledByDefault: true

 Enabled: true

 Enabled: true

 Enabled: true

When all cops are disabled as shown above, the warning about pending cops is not shown. Because in this case, we are in control of which cops we are using in our application.

What happens to pending cops?

Pending cops will be marked as enabled or disabled during a major release of Rubocop. In case of Rubocop, next major release will be 1.0. This policy is on the same lines of how ESLint introduces new linters.

You can join my mailing list to be in touch with the latest changes happening to Rubocop.


Join Hacker Noon

Create your free account to unlock your custom reading experience.