Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 717 Bytes

Lint-RedundantCopEnableDirective.md

File metadata and controls

40 lines (30 loc) · 717 Bytes

Pattern: Redundant rubocop:enable directive

Issue: -

Description

This rule detects instances of rubocop:enable comments that can be removed.

When comment enables all cops at once rubocop:enable all that cop checks whether any cop was actually enabled.

Examples

# bad
foo = 1
# rubocop:enable Layout/LineLength

# good
foo = 1
# bad
# rubocop:disable Style/StringLiterals
foo = "1"
# rubocop:enable Style/StringLiterals
baz
# rubocop:enable all

# good
# rubocop:disable Style/StringLiterals
foo = "1"
# rubocop:enable all
baz

Further Reading