| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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.analysis_options.error.option_codes; | 5 library analyzer.src.analysis_options.error.option_codes; |
| 6 | 6 |
| 7 import 'package:analyzer/error/error.dart'; | 7 import 'package:analyzer/error/error.dart'; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The error codes used for errors in analysis options files. The convention for | 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 | 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 | 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. | 13 * wrong and, when appropriate, how the problem can be corrected. |
| 14 */ | 14 */ |
| 15 class AnalysisOptionsErrorCode extends ErrorCode { | 15 class AnalysisOptionsErrorCode extends ErrorCode { |
| 16 /** | 16 /** |
| 17 * An error code indicating that there is a syntactic error in the included |
| 18 * file. |
| 19 * |
| 20 * Parameters: |
| 21 * 0: the path of the file containing the error |
| 22 * 1: the starting offset of the text in the file that contains the error |
| 23 * 2: the ending offset of the text in the file that contains the error |
| 24 * 3: the error message |
| 25 */ |
| 26 static const AnalysisOptionsErrorCode INCLUDED_FILE_PARSE_ERROR = |
| 27 const AnalysisOptionsErrorCode( |
| 28 'INCLUDED_FILE_PARSE_ERROR', '{3} in {0}({1}..{2})'); |
| 29 |
| 30 /** |
| 17 * An error code indicating that there is a syntactic error in the file. | 31 * An error code indicating that there is a syntactic error in the file. |
| 18 * | 32 * |
| 19 * Parameters: | 33 * Parameters: |
| 20 * 0: the error message from the parse error | 34 * 0: the error message from the parse error |
| 21 */ | 35 */ |
| 22 static const AnalysisOptionsErrorCode PARSE_ERROR = | 36 static const AnalysisOptionsErrorCode PARSE_ERROR = |
| 23 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); | 37 const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}'); |
| 24 | 38 |
| 25 /** | 39 /** |
| 26 * An error code indicating that there is a syntactic error | |
| 27 * in the included file. | |
| 28 * | |
| 29 * Parameters: | |
| 30 * 0: the path of the file containing the error | |
| 31 * 1: the starting offset of the text in the file that contains the error | |
| 32 * 2: the ending offset of the text in the file that contains the error | |
| 33 * 3: the error message | |
| 34 */ | |
| 35 static const INCLUDED_FILE_PARSE_ERROR = const AnalysisOptionsErrorCode( | |
| 36 'INCLUDED_FILE_PARSE_ERROR', '{3} in {0}({1}..{2})'); | |
| 37 | |
| 38 /** | |
| 39 * Initialize a newly created error code to have the given [name]. | 40 * Initialize a newly created error code to have the given [name]. |
| 40 */ | 41 */ |
| 41 const AnalysisOptionsErrorCode(String name, String message, | 42 const AnalysisOptionsErrorCode(String name, String message, |
| 42 [String correction]) | 43 [String correction]) |
| 43 : super(name, message, correction); | 44 : super(name, message, correction); |
| 44 | 45 |
| 45 @override | 46 @override |
| 46 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 47 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 47 | 48 |
| 48 @override | 49 @override |
| (...skipping 25 matching lines...) Expand all Loading... |
| 74 * 0: the path of the file containing the warnings | 75 * 0: the path of the file containing the warnings |
| 75 * 1: the starting offset of the text in the file that contains the warning | 76 * 1: the starting offset of the text in the file that contains the warning |
| 76 * 2: the ending offset of the text in the file that contains the warning | 77 * 2: the ending offset of the text in the file that contains the warning |
| 77 * 3: the warning message | 78 * 3: the warning message |
| 78 */ | 79 */ |
| 79 static const AnalysisOptionsWarningCode INCLUDED_FILE_WARNING = | 80 static const AnalysisOptionsWarningCode INCLUDED_FILE_WARNING = |
| 80 const AnalysisOptionsWarningCode('INCLUDED_FILE_WARNING', | 81 const AnalysisOptionsWarningCode('INCLUDED_FILE_WARNING', |
| 81 "Warning in the included options file {0}({1}..{2}): {3}"); | 82 "Warning in the included options file {0}({1}..{2}): {3}"); |
| 82 | 83 |
| 83 /** | 84 /** |
| 84 * An error code indicating that a plugin is being configured with an | 85 * An error code indicating that an unrecognized error code is being used to |
| 85 * unsupported option and legal options are provided. | 86 * specify an error filter. |
| 86 * | 87 * |
| 87 * Parameters: | 88 * Parameters: |
| 88 * 0: the plugin name | 89 * 0: the unrecognized error code |
| 89 * 1: the unsupported option key | |
| 90 * 2: legal values | |
| 91 */ | 90 */ |
| 92 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES = | 91 static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE = |
| 93 const AnalysisOptionsWarningCode( | 92 const AnalysisOptionsWarningCode( |
| 94 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES', | 93 'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code."); |
| 95 "The option '{1}' isn't supported by '{0}'.", | |
| 96 "Try using one of the supported options: {2}."); | |
| 97 | 94 |
| 98 /** | 95 /** |
| 99 * An error code indicating that a plugin is being configured with an | 96 * An error code indicating that a plugin is being configured with an |
| 100 * unsupported option where there is just one legal value. | 97 * unsupported option where there is just one legal value. |
| 101 * | 98 * |
| 102 * Parameters: | 99 * Parameters: |
| 103 * 0: the plugin name | 100 * 0: the plugin name |
| 104 * 1: the unsupported option key | 101 * 1: the unsupported option key |
| 105 * 2: the legal value | 102 * 2: the legal value |
| 106 */ | 103 */ |
| 107 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE = | 104 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE = |
| 108 const AnalysisOptionsWarningCode( | 105 const AnalysisOptionsWarningCode( |
| 109 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE', | 106 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE', |
| 110 "The option '{1}' isn't supported by '{0}'." | 107 "The option '{1}' isn't supported by '{0}'." |
| 111 "Try using the only supported option: '{2}'."); | 108 "Try using the only supported option: '{2}'."); |
| 112 | 109 |
| 113 /** | 110 /** |
| 111 * An error code indicating that a plugin is being configured with an |
| 112 * unsupported option and legal options are provided. |
| 113 * |
| 114 * Parameters: |
| 115 * 0: the plugin name |
| 116 * 1: the unsupported option key |
| 117 * 2: legal values |
| 118 */ |
| 119 static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES = |
| 120 const AnalysisOptionsWarningCode( |
| 121 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES', |
| 122 "The option '{1}' isn't supported by '{0}'.", |
| 123 "Try using one of the supported options: {2}."); |
| 124 |
| 125 /** |
| 114 * An error code indicating that an option entry is being configured with an | 126 * An error code indicating that an option entry is being configured with an |
| 115 * unsupported value. | 127 * unsupported value. |
| 116 * | 128 * |
| 117 * Parameters: | 129 * Parameters: |
| 118 * 0: the option name | 130 * 0: the option name |
| 119 * 1: the unsupported value | 131 * 1: the unsupported value |
| 120 * 2: legal values | 132 * 2: legal values |
| 121 */ | 133 */ |
| 122 static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE = | 134 static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE = |
| 123 const AnalysisOptionsWarningCode( | 135 const AnalysisOptionsWarningCode( |
| 124 'UNSUPPORTED_VALUE', | 136 'UNSUPPORTED_VALUE', |
| 125 "The value '{1}' isn't supported by '{0}'.", | 137 "The value '{1}' isn't supported by '{0}'.", |
| 126 "Try using one of the supported options: {2}."); | 138 "Try using one of the supported options: {2}."); |
| 127 | 139 |
| 128 /** | 140 /** |
| 129 * An error code indicating that an unrecognized error code is being used to | |
| 130 * specify an error filter. | |
| 131 * | |
| 132 * Parameters: | |
| 133 * 0: the unrecognized error code | |
| 134 */ | |
| 135 static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE = | |
| 136 const AnalysisOptionsWarningCode( | |
| 137 'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code."); | |
| 138 | |
| 139 /** | |
| 140 * Initialize a newly created warning code to have the given [name]. | 141 * Initialize a newly created warning code to have the given [name]. |
| 141 */ | 142 */ |
| 142 const AnalysisOptionsWarningCode(String name, String message, | 143 const AnalysisOptionsWarningCode(String name, String message, |
| 143 [String correction]) | 144 [String correction]) |
| 144 : super(name, message, correction); | 145 : super(name, message, correction); |
| 145 | 146 |
| 146 @override | 147 @override |
| 147 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; | 148 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
| 148 | 149 |
| 149 @override | 150 @override |
| 150 ErrorType get type => ErrorType.STATIC_WARNING; | 151 ErrorType get type => ErrorType.STATIC_WARNING; |
| 151 } | 152 } |
| OLD | NEW |