Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 549 Bytes

ignore-rubocop-block-length-lint-in-rspec.md

File metadata and controls

16 lines (12 loc) · 549 Bytes

Ignore Rubocop Block Length Lint in RSpec

Linters are great, except when they aren't. One example is Rubocop's BlockLength lint. For example, I don't care if my RSpec describe and context blocks are too long. Nontrivial test blocks will never be short enough to match a reasonable rule about blocks.

I've disabled this lint for these blocks with Rubocop's configuration file:

# .rubocop.yml
Metrics/BlockLength:
  IgnoredMethods: ['context', 'describe']

Opting out of just these blocks lets me enforce this rule everywhere else.