| OLD | NEW |
| 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.src.task.options; | 5 library analyzer.src.task.options; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/plugin/options.dart'; | 10 import 'package:analyzer/plugin/options.dart'; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 new AnalyzerOptionsValidator(), | 404 new AnalyzerOptionsValidator(), |
| 405 new LinterOptionsValidator(), | 405 new LinterOptionsValidator(), |
| 406 new LinterRuleOptionsValidator() | 406 new LinterRuleOptionsValidator() |
| 407 ]; | 407 ]; |
| 408 | 408 |
| 409 OptionsFileValidator(this.source); | 409 OptionsFileValidator(this.source); |
| 410 | 410 |
| 411 List<AnalysisError> validate(Map<String, YamlNode> options) { | 411 List<AnalysisError> validate(Map<String, YamlNode> options) { |
| 412 RecordingErrorListener recorder = new RecordingErrorListener(); | 412 RecordingErrorListener recorder = new RecordingErrorListener(); |
| 413 ErrorReporter reporter = new ErrorReporter(recorder, source); | 413 ErrorReporter reporter = new ErrorReporter(recorder, source); |
| 414 if (AnalysisEngine.ANALYSIS_OPTIONS_FILE == source.shortName) { |
| 415 reporter.reportError(new AnalysisError( |
| 416 source, |
| 417 0, // offset |
| 418 1, // length |
| 419 AnalysisOptionsHintCode.DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME, |
| 420 [source.shortName])); |
| 421 } |
| 414 _validators.forEach((OptionsValidator v) => v.validate(reporter, options)); | 422 _validators.forEach((OptionsValidator v) => v.validate(reporter, options)); |
| 415 return recorder.errors; | 423 return recorder.errors; |
| 416 } | 424 } |
| 417 } | 425 } |
| 418 | 426 |
| 419 /// Validates `analyzer` strong-mode value configuration options. | 427 /// Validates `analyzer` strong-mode value configuration options. |
| 420 class StrongModeOptionValueValidator extends OptionsValidator { | 428 class StrongModeOptionValueValidator extends OptionsValidator { |
| 421 ErrorBuilder trueOrFalseBuilder = new TrueOrFalseValueErrorBuilder(); | 429 ErrorBuilder trueOrFalseBuilder = new TrueOrFalseValueErrorBuilder(); |
| 422 | 430 |
| 423 @override | 431 @override |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 } | 623 } |
| 616 }); | 624 }); |
| 617 } else if (config is Map) { | 625 } else if (config is Map) { |
| 618 options.strongMode = true; | 626 options.strongMode = true; |
| 619 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); | 627 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); |
| 620 } else { | 628 } else { |
| 621 options.strongMode = config is bool ? config : false; | 629 options.strongMode = config is bool ? config : false; |
| 622 } | 630 } |
| 623 } | 631 } |
| 624 } | 632 } |
| OLD | NEW |