StyleRule class abstract
A style rule: a check of one Dart file that reports violations.
Inspectra's own rules and the custom rules of a package implement this interface. A rule must be deterministic and must not keep state between files; it may be called for many files in any order.
final class NoPrintRule extends StyleRule {
const NoPrintRule();
@override
String get id => 'no_print';
@override
String get description => 'Use a logger instead of print.';
@override
void check(StyleFile file, StyleReporter reporter) {
file.unit.accept(_PrintVisitor(reporter));
}
}
Constructors
- StyleRule()
-
Allows subclasses to have constant constructors.
const
Properties
- description → String
-
One sentence describing what the rule requires.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The unique id of the rule in lower snake case, such as
no_print. It is used in the configuration, in ignore comments and in reports.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
check(
StyleFile file, StyleReporter reporter) → void -
Checks
fileand reports every violation toreporter. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited