DocumentFakeParametersAnalyzer class
Analyzer that ensures Fake classes and their non-private members have documentation.
This rule flags Fake classes (classes that extend Fake or have "Fake" in their name) that implement interfaces but lack proper documentation for their test helper methods and variables. It improves test maintainability and ensures test helpers are documented for team collaboration.
Example of code that triggers this rule:
class FakeAuthService extends Fake implements AuthService {
void setAuthDelay(Duration delay) { ... } // Missing documentation
void triggerAuthFailure() { ... } // Missing documentation
}
class FakeUserRepository implements UserRepository {
void setMockData(List<User> users) { ... } // Missing documentation
}
Example of code that doesn't trigger this rule:
/// Fake implementation of AuthService for testing.
class FakeAuthService extends Fake implements AuthService {
/// Sets authentication delay for testing timing scenarios.
void setAuthDelay(Duration delay) { ... }
/// Simulates authentication failure for error handling tests.
void triggerAuthFailure() { ... }
@override
Future<void> authenticate() async { ... } // Override - no documentation needed
}
- Inheritance
-
- Object
- BaseAnalyzer
- DocumentFakeParametersAnalyzer
Constructors
Properties
- correctionMessage → String
-
The suggested correction message for fixing a violation of this rule.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- problemMessage → String
-
The main problem message shown when this rule is violated.
no setteroverride
- ruleName → String
-
The unique name of the lint rule implemented by this analyzer.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- severity → String
-
The severity of the lint rule (e.g., 'ERROR', 'WARNING').
no setterinherited
Methods
-
analyze(
CompilationUnit unit) → List< LintIssue> -
Analyze the given
CompilationUnitand return a list of LintIssues.override -
analyzeWithResolver(
CompilationUnit unit, dynamic resolver) → List< LintIssue> -
Analyze the given
CompilationUnitwith resolver context and return a list of LintIssues.inherited -
createIssue(
AstNode node, {String? customMessage}) → LintIssue -
Helper to create a LintIssue from an
AstNodewith consistent formatting.inherited -
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