Skip to content

Commit ce0c219

Browse files
stereotype441Commit Queue
authored andcommitted
[analyzer_cli] Remove unused CommandLineOptions.
Removes the field `AnalyzerImpl.options`, the `options` parameter of the method `Driver._runAnalyzer`, and the `commandLineOptions` parameters of the functions `computeSeverity` and `determineProcessedSeverity`. None of these were used. Change-Id: I6a6a6964617cecb81f0d1c6570be1d78fb599af4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463085 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 9bef322 commit ce0c219

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

pkg/analyzer_cli/lib/src/analyzer_impl.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ import 'package:analyzer/src/generated/engine.dart';
1515
import 'package:analyzer_cli/src/driver.dart';
1616
import 'package:analyzer_cli/src/error_formatter.dart';
1717
import 'package:analyzer_cli/src/error_severity.dart';
18-
import 'package:analyzer_cli/src/options.dart';
1918
import 'package:path/path.dart' as path;
2019

2120
int get currentTimeMillis => DateTime.now().millisecondsSinceEpoch;
2221

2322
/// Analyzes single library [File].
2423
class AnalyzerImpl {
25-
final CommandLineOptions options;
2624
final int startTime;
2725

2826
final AnalysisOptions analysisOptions;
@@ -53,7 +51,6 @@ class AnalyzerImpl {
5351
this.analysisOptions,
5452
this.analysisDriver,
5553
this.libraryFile,
56-
this.options,
5754
this.stats,
5855
this.startTime,
5956
this.gotErrorsFor,
@@ -126,9 +123,7 @@ class AnalyzerImpl {
126123
if (_defaultSeverityProcessor(diagnostic) == null) {
127124
continue;
128125
}
129-
status = status.max(
130-
computeSeverity(diagnostic, options, analysisOptions)!,
131-
);
126+
status = status.max(computeSeverity(diagnostic, analysisOptions)!);
132127
}
133128
}
134129
return status;
@@ -191,7 +186,7 @@ class AnalyzerImpl {
191186
}
192187

193188
DiagnosticSeverity? _defaultSeverityProcessor(Diagnostic diagnostic) =>
194-
determineProcessedSeverity(diagnostic, options, analysisOptions);
189+
determineProcessedSeverity(diagnostic, analysisOptions);
195190

196191
/// Returns true if we want to report diagnostics for this library.
197192
bool _isAnalyzedLibrary(LibraryElement library) {

pkg/analyzer_cli/lib/src/driver.dart

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ class Driver implements CommandLineStarter {
184184
var file = analysisDriver!.resourceProvider.getFile(filePath);
185185
return determineProcessedSeverity(
186186
diagnostic,
187-
options,
188187
analysisDriver!.getAnalysisOptionsForFile(file),
189188
);
190189
};
@@ -299,11 +298,7 @@ class Driver implements CommandLineStarter {
299298
),
300299
]);
301300
for (var error in errors) {
302-
var severity = determineProcessedSeverity(
303-
error,
304-
options,
305-
analysisOptions,
306-
);
301+
var severity = determineProcessedSeverity(error, analysisOptions);
307302
if (severity != null) {
308303
allResult = allResult.max(severity);
309304
}
@@ -331,7 +326,6 @@ class Driver implements CommandLineStarter {
331326
for (var error in diagnostics) {
332327
var severity = determineProcessedSeverity(
333328
error,
334-
options,
335329
analysisOptions,
336330
)!;
337331
allResult = allResult.max(severity);
@@ -384,7 +378,6 @@ class Driver implements CommandLineStarter {
384378
for (var error in errors) {
385379
var severity = determineProcessedSeverity(
386380
error,
387-
options,
388381
analysisOptions,
389382
)!;
390383
allResult = allResult.max(severity);
@@ -398,12 +391,7 @@ class Driver implements CommandLineStarter {
398391

399392
final kind = file.kind;
400393
if (kind is LibraryFileKind) {
401-
var status = await _runAnalyzer(
402-
file,
403-
options,
404-
formatter,
405-
gotErrorsFor,
406-
);
394+
var status = await _runAnalyzer(file, formatter, gotErrorsFor);
407395
allResult = allResult.max(status);
408396
analyzedFiles.addAll(kind.files);
409397
} else if (kind is PartFileKind) {
@@ -472,7 +460,6 @@ class Driver implements CommandLineStarter {
472460
/// Analyze a single source.
473461
Future<DiagnosticSeverity> _runAnalyzer(
474462
FileState file,
475-
CommandLineOptions options,
476463
ErrorFormatter formatter,
477464
Set<String> gotErrorsFor,
478465
) {
@@ -485,7 +472,6 @@ class Driver implements CommandLineStarter {
485472
analysisOptions,
486473
analysisDriver,
487474
file,
488-
options,
489475
stats,
490476
startTime,
491477
gotErrorsFor,

pkg/analyzer_cli/lib/src/error_severity.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import 'package:analyzer/diagnostic/diagnostic.dart';
66
import 'package:analyzer/error/error.dart';
77
import 'package:analyzer/source/error_processor.dart';
88
import 'package:analyzer/src/generated/engine.dart';
9-
import 'package:analyzer_cli/src/options.dart';
109

1110
/// Compute the severity of the error; however:
1211
/// - if `options.enableTypeChecks` is false, then de-escalate checked-mode
1312
/// compile time errors to a severity of [DiagnosticSeverity.INFO].
1413
/// - if `options.lintsAreFatal` is true, escalate lints to errors.
1514
DiagnosticSeverity? computeSeverity(
1615
Diagnostic diagnostic,
17-
CommandLineOptions commandLineOptions,
1816
AnalysisOptions analysisOptions,
1917
) {
2018
var processor = ErrorProcessor.getProcessor(analysisOptions, diagnostic);
@@ -30,14 +28,9 @@ DiagnosticSeverity? computeSeverity(
3028
/// [diagnostic] (or `null` if it's to be suppressed).
3129
DiagnosticSeverity? determineProcessedSeverity(
3230
Diagnostic diagnostic,
33-
CommandLineOptions commandLineOptions,
3431
AnalysisOptions analysisOptions,
3532
) {
36-
var severity = computeSeverity(
37-
diagnostic,
38-
commandLineOptions,
39-
analysisOptions,
40-
);
33+
var severity = computeSeverity(diagnostic, analysisOptions);
4134
// Skip TODOs categorically unless escalated to ERROR or HINT (#26215).
4235
if (diagnostic.diagnosticCode.type == DiagnosticType.TODO &&
4336
severity == DiagnosticSeverity.INFO) {

0 commit comments

Comments
 (0)