AvoidPassingSelfAsArgument class

Warns when an object is passed as an argument to its own method.

Detects patterns like list.addAll(list) or object.work(object) where the same reference appears as both the method target and an argument.

Properties

canUseParsedResult bool
Indicates whether this analysis rule can work with just the parsed information or if it requires a resolved unit.
no setterinherited
code → DcqLintCode
no setterinherited
description String
Short description suitable for display in console output and IDEs.
finalinherited
diagnosticCode → DiagnosticCode
The code to report for a violation.
no setterinherited
diagnosticCodes List<DiagnosticCode>
The diagnostic codes associated with this analysis rule.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
incompatibleRules List<String>
A list of incompatible rule names.
no setterinherited
name String
The rule name.
finalinherited
needsResolvedUnit bool
no setterinherited
pubspecVisitor → PubspecVisitor?
A visitor that visits a Pubspec to perform analysis.
no setterinherited
reporter ← DiagnosticReporter
Reset disabled status when the reporter changes (new file).
no getterinherited
ruleConfig Map<String, Object?>
Rule-specific configuration read lazily from analysis_options.yaml.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → RuleState
The state of this analysis rule.
finalinherited

Methods

check(DcqRegistry registry) → void
effectiveBool(String key, bool fallback) bool
Reads a bool config value, preferring per-file config over constructor default.
inherited
effectiveInt(String key, int fallback) int
Reads an int config value, preferring per-file config over constructor default.
inherited
effectiveString(String key, String fallback) String
Reads a String config value, preferring per-file config over constructor default.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerNodeProcessors(RuleVisitorRegistry registry, RuleContext context) → void
Registers node processors in the given registry.
inherited
reportAtNode(AstNode? node, {List<Object> arguments = const [], List<DiagnosticMessage>? contextMessages}) → Diagnostic?
Reports a diagnostic at node with message arguments and contextMessages.
inherited
reportAtOffset(int offset, int length, {List<Object> arguments = const [], List<DiagnosticMessage>? contextMessages}) → Diagnostic
Reports a diagnostic at offset, with length, with message arguments and contextMessages.
inherited
reportAtPubNode(PubspecNode node, {List<Object> arguments = const [], List<DiagnosticMessage> contextMessages = const []}) → Diagnostic
Reports a diagnostic at Pubspec node, with message arguments and contextMessages.
inherited
reportAtSourceRange(SourceRange sourceRange, {List<Object> arguments = const [], List<DiagnosticMessage>? contextMessages}) → Diagnostic
Reports a diagnostic at sourceRange, with message arguments and contextMessages.
inherited
reportAtToken(Token token, {List<Object> arguments = const [], List<DiagnosticMessage>? contextMessages}) → Diagnostic?
Reports a diagnostic at token, with message arguments and contextMessages.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited