Skip to content

Commit

Permalink
linter: always propagate exceptions
Browse files Browse the repository at this point in the history
Every caller of analysisOptionsContent passes
`propagateLinterExceptions: true`. Good to just simplify.

Change-Id: I69d5411a985e58b104086a68c5ba5debc77a9696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391202
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
  • Loading branch information
srawlins authored and Commit Queue committed Oct 21, 2024
1 parent ca8de09 commit 1c86ca0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
35 changes: 10 additions & 25 deletions pkg/linter/test/rule_test_support.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,20 @@ export 'package:linter/src/lint_names.dart';
String analysisOptionsContent({
List<String> experiments = const [],
List<String> rules = const [],
bool propagateLinterExceptions = false,
}) {
var buffer = StringBuffer();

if (experiments.isNotEmpty || propagateLinterExceptions) {
buffer.writeln('analyzer:');
buffer.writeln(' enable-experiment:');
for (var experiment in experiments) {
buffer.writeln(' - $experiment');
}

if (propagateLinterExceptions) {
buffer.writeln(' optional-checks:');
buffer.writeln(
' propagate-linter-exceptions: $propagateLinterExceptions',
);
}
buffer.writeln('analyzer:');
buffer.writeln(' enable-experiment:');
for (var experiment in experiments) {
buffer.writeln(' - $experiment');
}

buffer.writeln(' optional-checks:');
buffer.writeln(
' propagate-linter-exceptions: true',
);

buffer.writeln('linter:');
buffer.writeln(' rules:');
for (var rule in rules) {
Expand Down Expand Up @@ -140,12 +135,6 @@ class ExpectedLint extends ExpectedDiagnostic {
{Pattern? messageContains})
: super((error) => error.errorCode.name == _lintName, offset, length,
messageContains: messageContains);

ExpectedLint.withLintCode(LintCode lintCode, int offset, int length,
{Pattern? messageContains})
: _lintName = lintCode.uniqueName,
super((error) => error.errorCode == lintCode, offset, length,
messageContains: messageContains);
}

mixin LanguageVersion219Mixin on PubPackageResolutionTest {
Expand Down Expand Up @@ -395,11 +384,7 @@ class PubPackageResolutionTest extends _ContextResolutionTest {

newAnalysisOptionsYamlFile(
testPackageRootPath,
analysisOptionsContent(
experiments: experiments,
rules: _lintRules,
propagateLinterExceptions: true,
),
analysisOptionsContent(experiments: experiments, rules: _lintRules),
);
writeTestPackageConfig(
PackageConfigFileBuilder(),
Expand Down
6 changes: 1 addition & 5 deletions pkg/linter/test/rules/public_member_api_docs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,7 @@ class PublicMemberApiDocsTestPackageTest extends LintRuleTest {
myPackageRootPath, pubspecYamlContent(name: 'myPackage'));
newAnalysisOptionsYamlFile(
myPackageRootPath,
analysisOptionsContent(
experiments: experiments,
rules: lintRules,
propagateLinterExceptions: true,
),
analysisOptionsContent(experiments: experiments, rules: lintRules),
);
newFolder(fixturePackageLibPath);
writePackageConfig(
Expand Down

0 comments on commit 1c86ca0

Please sign in to comment.