| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 Source get source => target.source; | 231 Source get source => target.source; |
| 232 | 232 |
| 233 @override | 233 @override |
| 234 void internalPerform() { | 234 void internalPerform() { |
| 235 String content = getRequiredInput(CONTENT_INPUT_NAME); | 235 String content = getRequiredInput(CONTENT_INPUT_NAME); |
| 236 | 236 |
| 237 List<AnalysisError> errors = <AnalysisError>[]; | 237 List<AnalysisError> errors = <AnalysisError>[]; |
| 238 Source initialSource = source; | 238 Source initialSource = source; |
| 239 SourceSpan initialIncludeSpan; | 239 SourceSpan initialIncludeSpan; |
| 240 | 240 |
| 241 // Suggest user rename deprecated .analysis_options file | |
| 242 String fullName = target?.source?.fullName; | |
| 243 if (fullName != null && | |
| 244 fullName.endsWith(AnalysisEngine.ANALYSIS_OPTIONS_FILE)) { | |
| 245 errors.add(new AnalysisError( | |
| 246 source, | |
| 247 0, // offset | |
| 248 1, // length | |
| 249 AnalysisOptionsWarningCode.DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME, | |
| 250 [fullName])); | |
| 251 } | |
| 252 | |
| 253 // Validate the specified options and any included option files | 241 // Validate the specified options and any included option files |
| 254 void validate(Source source, Map<String, YamlNode> options) { | 242 void validate(Source source, Map<String, YamlNode> options) { |
| 255 List<AnalysisError> validationErrors = | 243 List<AnalysisError> validationErrors = |
| 256 new OptionsFileValidator(source).validate(options); | 244 new OptionsFileValidator(source).validate(options); |
| 257 if (initialIncludeSpan != null && validationErrors.isNotEmpty) { | 245 if (initialIncludeSpan != null && validationErrors.isNotEmpty) { |
| 258 for (AnalysisError error in validationErrors) { | 246 for (AnalysisError error in validationErrors) { |
| 259 var args = [ | 247 var args = [ |
| 260 source.fullName, | 248 source.fullName, |
| 261 error.offset.toString(), | 249 error.offset.toString(), |
| 262 (error.offset + error.length - 1).toString(), | 250 (error.offset + error.length - 1).toString(), |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 586 } |
| 599 }); | 587 }); |
| 600 } else if (config is Map) { | 588 } else if (config is Map) { |
| 601 options.strongMode = true; | 589 options.strongMode = true; |
| 602 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); | 590 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); |
| 603 } else { | 591 } else { |
| 604 options.strongMode = config is bool ? config : false; | 592 options.strongMode = config is bool ? config : false; |
| 605 } | 593 } |
| 606 } | 594 } |
| 607 } | 595 } |
| OLD | NEW |