Skip to content

unknown-rule-in-directive

all languagessuspiciousno fixdefault: offruby/rubocop

Reports a comment that disables rules of another tool (# rubocop:disable Foo/Bar) by a Group/Name whose group the tool does not have, for example the group of an extension that is not installed. A name inside a known group is not checked (the groups are listed in the grammar’s suppress directive-group rows).

A directive with a group the tool does not have does not suppress what the author expects, so the finding stays or the directive is ignored. It is usually a typo in the group name or an extension that is missing in the project.

To fix, correct the name, or install the extension.

Reported
...
1
...
end
# rubocop:disable Foo/Bar
...
lint:
rules:
unknown-rule-in-directive: warn # off (default), warn, error

Enabled by the presets: ruby/rubocop.

Suppress one line with sudsy-disable-next-line unknown-rule-in-directive in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
rubocop Lint/CopDirectiveSyntax partial only the unknown department of a cop name; not the other malformed directives or an unknown cop of a known department