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 |
241 // Validate the specified options and any included option files | 253 // Validate the specified options and any included option files |
242 void validate(Source source, Map<String, YamlNode> options) { | 254 void validate(Source source, Map<String, YamlNode> options) { |
243 List<AnalysisError> validationErrors = | 255 List<AnalysisError> validationErrors = |
244 new OptionsFileValidator(source).validate(options); | 256 new OptionsFileValidator(source).validate(options); |
245 if (initialIncludeSpan != null && validationErrors.isNotEmpty) { | 257 if (initialIncludeSpan != null && validationErrors.isNotEmpty) { |
246 for (AnalysisError error in validationErrors) { | 258 for (AnalysisError error in validationErrors) { |
247 var args = [ | 259 var args = [ |
248 source.fullName, | 260 source.fullName, |
249 error.offset.toString(), | 261 error.offset.toString(), |
250 (error.offset + error.length - 1).toString(), | 262 (error.offset + error.length - 1).toString(), |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 } | 598 } |
587 }); | 599 }); |
588 } else if (config is Map) { | 600 } else if (config is Map) { |
589 options.strongMode = true; | 601 options.strongMode = true; |
590 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); | 602 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); |
591 } else { | 603 } else { |
592 options.strongMode = config is bool ? config : false; | 604 options.strongMode = config is bool ? config : false; |
593 } | 605 } |
594 } | 606 } |
595 } | 607 } |
OLD | NEW |