You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it's necessary to disable a SwiftLint rule in code, with the // swiftlint:disable rule_name directive, but engineers intentionally just put the disable at the top of, and applying to the, the entire file, when only a short stretch of code is relevant.
At other times, developers may intend to re-enable the SwiftLint rule, but forget to do so.
In either case, swiftlint rules can end up being disabled for stretches of code that we actually probably do want to lint.
This rule would warn on any cases of // swiftlint:disable rule_name that do not have a matching enable before the end of the file.
Provide several examples of what would and wouldn't trigger violations.
New Issue Checklist
New rule request
Sometimes it's necessary to disable a SwiftLint rule in code, with the
// swiftlint:disable rule_name
directive, but engineers intentionally just put the disable at the top of, and applying to the, the entire file, when only a short stretch of code is relevant.At other times, developers may intend to re-enable the SwiftLint rule, but forget to do so.
In either case, swiftlint rules can end up being disabled for stretches of code that we actually probably do want to lint.
This rule would warn on any cases of
// swiftlint:disable rule_name
that do not have a matchingenable
before the end of the file.Triggering examples:
Non-triggering examples:
For some rules, such as
file_length
it doesn't make sense to reenable them.An
allowed_rules
parameter would specify rules that will be ignored by this rule.See README.md for guidelines on when to mark a rule as opt-in.
opt-in, as users should never really want to disable rules for irrelevant stretches of code.
The text was updated successfully, but these errors were encountered: