Allow more information when creating pubspec lints

Change-Id: Icf031b4f57eeb7861ddb9f5aa011087fa002c1ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263681
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2022-10-12 03:15:37 +00:00 committed by Commit Queue
parent 1b5e8d6c7d
commit 48f33cc37a

View file

@ -697,11 +697,20 @@ abstract class LintRule extends Linter implements Comparable<LintRule> {
}
}
void reportPubLint(PSNode node) {
void reportPubLint(PSNode node,
{List<Object> arguments = const [],
List<DiagnosticMessage> contextMessages = const [],
ErrorCode? errorCode}) {
var source = node.source;
// Cache error and location info for creating AnalysisErrorInfos
AnalysisError error = AnalysisError(
source, node.span.start.offset, node.span.length, lintCode);
source,
node.span.start.offset,
node.span.length,
errorCode ?? lintCode,
arguments,
contextMessages,
);
LineInfo lineInfo = LineInfo.fromContent(source.contents.data);
_locationInfo.add(AnalysisErrorInfoImpl([error], lineInfo));