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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/PubSuggestionCode.java

Issue 15736020: generate suggestions during analysis (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/PubSuggestionCode.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/PubSuggestionCode.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/PubSuggestionCode.java
new file mode 100644
index 0000000000000000000000000000000000000000..159a0c67963d6bb835f8db27ceb4fa6e3b129046
--- /dev/null
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/PubSuggestionCode.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.dart.engine.error;
+
+/**
+ * The enumeration {@code PubSuggestionCode} defines the suggestions used for reporting reporting
Brian Wilkerson 2013/05/31 15:28:58 "reporting reporting" --> "reporting"
danrubel 2013/05/31 19:43:45 Done.
+ * deviations from pub best practices. The convention for this class is for the name of the bad
+ * practice to indicate the problem that caused the suggestion to be generated and for the message
+ * to explain what is wrong and, when appropriate, how the situation can be corrected.
+ */
+public enum PubSuggestionCode implements ErrorCode {
+ /**
+ * It is a bad practice for a source file in a package "lib" directory hierarchy to traverse
+ * outside that directory hierarchy. For example, a source file in the "lib" directory should not
+ * contain a directive such as {@code import '../web/some.dart'} which references a file outside
+ * the lib directory.
+ */
+ FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE(
+ "A file in the 'lib' directory hierarchy should not reference a file outside that hierarchy"),
+
+ /**
+ * It is a bad practice for a source file ouside a package "lib" directory hierarchy to traverse
+ * into that directory hierarchy. For example, a source file in the "web" directory should not
+ * contain a directive such as {@code import '../lib/some.dart'} which references a file inside
+ * the lib directory.
+ */
+ FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE(
+ "A file outside the 'lib' directory hierarchy should not reference a file inside that hierarchy. Use a package: reference instead."),
+
+ /**
+ * It is a bad practice for a package import to reference anything outside the given package, or
+ * more generally, it is bad practice for a package import to contain a "..". For example, a
+ * source file should not contain a directive such as {@code import 'package:foo/../some.dart'}.
+ */
+ PACKAGE_IMPORT_CONTAINS_DOT_DOT("A package import should not contain '..'");
+
+ /**
+ * The message template used to create the message to be displayed for this error.
+ */
+ private final String message;
+
+ /**
+ * Initialize a newly created error code to have the given message.
+ *
+ * @param message the message template used to create the message to be displayed for the error
+ */
+ private PubSuggestionCode(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public ErrorSeverity getErrorSeverity() {
+ return ErrorType.PUB_SUGGESTION.getSeverity();
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ @Override
+ public ErrorType getType() {
+ return ErrorType.PUB_SUGGESTION;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698