Allow LintCode to override the default documentation URL

We need this in order to override the default as we start to migrate the
linter docs to the new format. We also need this for internal lints.

Change-Id: I9da7be2e6c657b390ae355cdfcd1e007c70769fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264061
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2022-10-18 17:57:41 +00:00 committed by Commit Queue
parent 521cbcdd47
commit 1ded24ae31

View file

@ -10,12 +10,16 @@ import 'package:analyzer/error/error.dart';
/// compiler, lint recommendations focus on matters of style and practices that
/// might aggregated to define a project's style guide.
class LintCode extends ErrorCode {
final String? _url;
const LintCode(
String name,
String problemMessage, {
super.correctionMessage,
String? uniqueName,
}) : super(
String? url,
}) : _url = url,
super(
problemMessage: problemMessage,
name: name,
uniqueName: uniqueName ?? 'LintCode.$name',
@ -31,7 +35,8 @@ class LintCode extends ErrorCode {
ErrorType get type => ErrorType.LINT;
@override
String get url => 'https://dart-lang.github.io/linter/lints/$name.html';
String get url =>
_url ?? 'https://dart-lang.github.io/linter/lints/$name.html';
@override
bool operator ==(Object other) =>