Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: pkg/analyzer/lib/src/analysis_options/error/option_codes.dart

Issue 2442463002: Split out error codes into separate files (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/dart/error/hint_codes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/analysis_options/error/option_codes.dart
diff --git a/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart b/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4b39a4515d3954822c73e4fb1259c0204a79049d
--- /dev/null
+++ b/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart
@@ -0,0 +1,114 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analyzer.src.analysis_options.error.option_codes;
+
+import 'package:analyzer/error/error.dart';
+
+/**
+ * The error codes used for errors in analysis options files. The convention for
+ * this class is for the name of the error code to indicate the problem that
+ * caused the error to be generated and for the error message to explain what is
+ * wrong and, when appropriate, how the problem can be corrected.
+ */
+class AnalysisOptionsErrorCode extends ErrorCode {
+ /**
+ * An error code indicating that there is a syntactic error in the file.
+ *
+ * Parameters:
+ * 0: the error message from the parse error
+ */
+ static const AnalysisOptionsErrorCode PARSE_ERROR =
+ const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}');
+
+ /**
+ * Initialize a newly created error code to have the given [name].
+ */
+ const AnalysisOptionsErrorCode(String name, String message,
+ [String correction])
+ : super(name, message, correction);
+
+ @override
+ ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
+
+ @override
+ ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
+}
+
+/**
+ * The error codes used for warnings in analysis options files. The convention
+ * for this class is for the name of the error code to indicate the problem that
+ * caused the error to be generated and for the error message to explain what is
+ * wrong and, when appropriate, how the problem can be corrected.
+ */
+class AnalysisOptionsWarningCode extends ErrorCode {
+ /**
+ * An error code indicating that a plugin is being configured with an
+ * unsupported option and legal options are provided.
+ *
+ * Parameters:
+ * 0: the plugin name
+ * 1: the unsupported option key
+ * 2: legal values
+ */
+ static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
+ const AnalysisOptionsWarningCode(
+ 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
+ "The option '{1}' isn't supported by '{0}'.",
+ "Try using one of the supported options: {2}.");
+
+ /**
+ * An error code indicating that a plugin is being configured with an
+ * unsupported option where there is just one legal value.
+ *
+ * Parameters:
+ * 0: the plugin name
+ * 1: the unsupported option key
+ * 2: the legal value
+ */
+ static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE =
+ const AnalysisOptionsWarningCode(
+ 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE',
+ "The option '{1}' isn't supported by '{0}'."
+ "Try using the only supported option: '{2}'.");
+
+ /**
+ * An error code indicating that an option entry is being configured with an
+ * unsupported value.
+ *
+ * Parameters:
+ * 0: the option name
+ * 1: the unsupported value
+ * 2: legal values
+ */
+ static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE =
+ const AnalysisOptionsWarningCode(
+ 'UNSUPPORTED_VALUE',
+ "The value '{1}' isn't supported by '{0}'.",
+ "Try using one of the supported options: {2}.");
+
+ /**
+ * An error code indicating that an unrecognized error code is being used to
+ * specify an error filter.
+ *
+ * Parameters:
+ * 0: the unrecognized error code
+ */
+ static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE =
+ const AnalysisOptionsWarningCode(
+ 'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code.");
+
+ /**
+ * Initialize a newly created warning code to have the given [name].
+ */
+ const AnalysisOptionsWarningCode(String name, String message,
+ [String correction])
+ : super(name, message, correction);
+
+ @override
+ ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
+
+ @override
+ ErrorType get type => ErrorType.STATIC_WARNING;
+}
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/dart/error/hint_codes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698