Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: pkg/analyzer_cli/lib/src/analyzer_impl.dart

Issue 1870123002: Suppress TODOs (#26215). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer_cli.src.analyzer_impl; 5 library analyzer_cli.src.analyzer_impl;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return null; 296 return null;
297 } 297 }
298 298
299 /// Check various configuration options to get a desired severity for this 299 /// Check various configuration options to get a desired severity for this
300 /// [error] (or `null` if it's to be suppressed). 300 /// [error] (or `null` if it's to be suppressed).
301 static ProcessedSeverity processError(AnalysisError error, 301 static ProcessedSeverity processError(AnalysisError error,
302 CommandLineOptions options, AnalysisContext context) { 302 CommandLineOptions options, AnalysisContext context) {
303 ErrorSeverity severity = computeSeverity(error, options, context); 303 ErrorSeverity severity = computeSeverity(error, options, context);
304 bool isOverridden = false; 304 bool isOverridden = false;
305 305
306 // Skip TODOs categorically (unless escalated to ERROR or HINT.)
307 // https://github.com/dart-lang/sdk/issues/26215
308 if (error.errorCode.type == ErrorType.TODO &&
309 severity == ErrorSeverity.INFO) {
310 return null;
311 }
312
306 // First check for a filter. 313 // First check for a filter.
307 if (severity == null) { 314 if (severity == null) {
308 // Null severity means the error has been explicitly ignored. 315 // Null severity means the error has been explicitly ignored.
309 return null; 316 return null;
310 } else { 317 } else {
311 isOverridden = true; 318 isOverridden = true;
312 } 319 }
313 320
314 // If not overridden, some "natural" severities get globally filtered. 321 // If not overridden, some "natural" severities get globally filtered.
315 if (!isOverridden) { 322 if (!isOverridden) {
316 // Check for global hint filtering. 323 // Check for global hint filtering.
317 if (severity == ErrorSeverity.INFO && options.disableHints) { 324 if (severity == ErrorSeverity.INFO && options.disableHints) {
318 return null; 325 return null;
319 } 326 }
320
321 // Skip TODOs.
322 if (severity == ErrorType.TODO) {
323 return null;
324 }
325 } 327 }
326 328
327 return new ProcessedSeverity(severity, isOverridden); 329 return new ProcessedSeverity(severity, isOverridden);
328 } 330 }
329 } 331 }
330 332
331 /// This [Logger] prints out information comments to [outSink] and error message s 333 /// This [Logger] prints out information comments to [outSink] and error message s
332 /// to [errorSink]. 334 /// to [errorSink].
333 class StdLogger extends Logger { 335 class StdLogger extends Logger {
334 StdLogger(); 336 StdLogger();
335 337
336 @override 338 @override
337 void logError(String message, [CaughtException exception]) { 339 void logError(String message, [CaughtException exception]) {
338 errorSink.writeln(message); 340 errorSink.writeln(message);
339 if (exception != null) { 341 if (exception != null) {
340 errorSink.writeln(exception); 342 errorSink.writeln(exception);
341 } 343 }
342 } 344 }
343 345
344 @override 346 @override
345 void logInformation(String message, [CaughtException exception]) { 347 void logInformation(String message, [CaughtException exception]) {
346 outSink.writeln(message); 348 outSink.writeln(message);
347 if (exception != null) { 349 if (exception != null) {
348 outSink.writeln(exception); 350 outSink.writeln(exception);
349 } 351 }
350 } 352 }
351 } 353 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer_cli/test/driver_test.dart » ('j') | pkg/analyzer_cli/test/driver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698