From 1c86ca09bf88c083f31d96d36c64a08d41d65718 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 21 Oct 2024 18:04:29 +0000 Subject: [PATCH] linter: always propagate exceptions 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 Auto-Submit: Samuel Rawlins Reviewed-by: Phil Quitslund --- pkg/linter/test/rule_test_support.dart | 35 ++++++------------- .../rules/public_member_api_docs_test.dart | 6 +--- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/pkg/linter/test/rule_test_support.dart b/pkg/linter/test/rule_test_support.dart index 4c784aab6094..4dd14573f39a 100644 --- a/pkg/linter/test/rule_test_support.dart +++ b/pkg/linter/test/rule_test_support.dart @@ -43,25 +43,20 @@ export 'package:linter/src/lint_names.dart'; String analysisOptionsContent({ List experiments = const [], List 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) { @@ -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 { @@ -395,11 +384,7 @@ class PubPackageResolutionTest extends _ContextResolutionTest { newAnalysisOptionsYamlFile( testPackageRootPath, - analysisOptionsContent( - experiments: experiments, - rules: _lintRules, - propagateLinterExceptions: true, - ), + analysisOptionsContent(experiments: experiments, rules: _lintRules), ); writeTestPackageConfig( PackageConfigFileBuilder(), diff --git a/pkg/linter/test/rules/public_member_api_docs_test.dart b/pkg/linter/test/rules/public_member_api_docs_test.dart index 264610987b26..84b8a66709d3 100644 --- a/pkg/linter/test/rules/public_member_api_docs_test.dart +++ b/pkg/linter/test/rules/public_member_api_docs_test.dart @@ -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(