OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library analyzer.src.analysis_options.error.option_codes; |
| 6 |
| 7 import 'package:analyzer/error/error.dart'; |
| 8 |
| 9 /** |
| 10 * The error codes used for errors in analysis options files. The convention for |
| 11 * this class is for the name of the error code to indicate the problem that |
| 12 * caused the error to be generated and for the error message to explain what is |
| 13 * wrong and, when appropriate, how the problem can be corrected. |
| 14 */ |
| 15 class AnalysisOptionsErrorCode extends ErrorCode { |
| 16 /** |
| 17 * An error code indicating that there is a syntactic error in the file. |
| 18 * |
| 19 * Parameters: |
| 20 * 0: the error message from the parse error |
| 21 */ |
| 22 static const AnalysisOptionsErrorCode PARSE_ERROR = |
| 23 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); |
| 24 |
| 25 /** |
| 26 * Initialize a newly created error code to have the given [name]. |
| 27 */ |
| 28 const AnalysisOptionsErrorCode(String name, String message, |
| 29 [String correction]) |
| 30 : super(name, message, correction); |
| 31 |
| 32 @override |
| 33 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 34 |
| 35 @override |
| 36 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 37 } |
| 38 |
| 39 /** |
| 40 * The error codes used for warnings in analysis options files. The convention |
| 41 * for this class is for the name of the error code to indicate the problem that |
| 42 * caused the error to be generated and for the error message to explain what is |
| 43 * wrong and, when appropriate, how the problem can be corrected. |
| 44 */ |
| 45 class AnalysisOptionsWarningCode extends ErrorCode { |
| 46 /** |
| 47 * An error code indicating that a plugin is being configured with an |
| 48 * unsupported option and legal options are provided. |
| 49 * |
| 50 * Parameters: |
| 51 * 0: the plugin name |
| 52 * 1: the unsupported option key |
| 53 * 2: legal values |
| 54 */ |
| 55 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES = |
| 56 const AnalysisOptionsWarningCode( |
| 57 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES', |
| 58 "The option '{1}' isn't supported by '{0}'.", |
| 59 "Try using one of the supported options: {2}."); |
| 60 |
| 61 /** |
| 62 * An error code indicating that a plugin is being configured with an |
| 63 * unsupported option where there is just one legal value. |
| 64 * |
| 65 * Parameters: |
| 66 * 0: the plugin name |
| 67 * 1: the unsupported option key |
| 68 * 2: the legal value |
| 69 */ |
| 70 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE = |
| 71 const AnalysisOptionsWarningCode( |
| 72 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE', |
| 73 "The option '{1}' isn't supported by '{0}'." |
| 74 "Try using the only supported option: '{2}'."); |
| 75 |
| 76 /** |
| 77 * An error code indicating that an option entry is being configured with an |
| 78 * unsupported value. |
| 79 * |
| 80 * Parameters: |
| 81 * 0: the option name |
| 82 * 1: the unsupported value |
| 83 * 2: legal values |
| 84 */ |
| 85 static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE = |
| 86 const AnalysisOptionsWarningCode( |
| 87 'UNSUPPORTED_VALUE', |
| 88 "The value '{1}' isn't supported by '{0}'.", |
| 89 "Try using one of the supported options: {2}."); |
| 90 |
| 91 /** |
| 92 * An error code indicating that an unrecognized error code is being used to |
| 93 * specify an error filter. |
| 94 * |
| 95 * Parameters: |
| 96 * 0: the unrecognized error code |
| 97 */ |
| 98 static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE = |
| 99 const AnalysisOptionsWarningCode( |
| 100 'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code."); |
| 101 |
| 102 /** |
| 103 * Initialize a newly created warning code to have the given [name]. |
| 104 */ |
| 105 const AnalysisOptionsWarningCode(String name, String message, |
| 106 [String correction]) |
| 107 : super(name, message, correction); |
| 108 |
| 109 @override |
| 110 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
| 111 |
| 112 @override |
| 113 ErrorType get type => ErrorType.STATIC_WARNING; |
| 114 } |
OLD | NEW |