OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2013, the Dart project authors. | |
3 * | |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except | |
5 * in compliance with the License. You may obtain a copy of the License at | |
6 * | |
7 * http://www.eclipse.org/legal/epl-v10.html | |
8 * | |
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License | |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express | |
11 * or implied. See the License for the specific language governing permissions a nd limitations under | |
12 * the License. | |
13 */ | |
14 package com.google.dart.engine.error; | |
15 | |
16 /** | |
17 * The enumeration {@code PubSuggestionCode} defines the suggestions used for re porting reporting | |
Brian Wilkerson
2013/05/31 15:28:58
"reporting reporting" --> "reporting"
danrubel
2013/05/31 19:43:45
Done.
| |
18 * deviations from pub best practices. The convention for this class is for the name of the bad | |
19 * practice to indicate the problem that caused the suggestion to be generated a nd for the message | |
20 * to explain what is wrong and, when appropriate, how the situation can be corr ected. | |
21 */ | |
22 public enum PubSuggestionCode implements ErrorCode { | |
23 /** | |
24 * It is a bad practice for a source file in a package "lib" directory hierarc hy to traverse | |
25 * outside that directory hierarchy. For example, a source file in the "lib" d irectory should not | |
26 * contain a directive such as {@code import '../web/some.dart'} which referen ces a file outside | |
27 * the lib directory. | |
28 */ | |
29 FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE( | |
30 "A file in the 'lib' directory hierarchy should not reference a file outsi de that hierarchy"), | |
31 | |
32 /** | |
33 * It is a bad practice for a source file ouside a package "lib" directory hie rarchy to traverse | |
34 * into that directory hierarchy. For example, a source file in the "web" dire ctory should not | |
35 * contain a directive such as {@code import '../lib/some.dart'} which referen ces a file inside | |
36 * the lib directory. | |
37 */ | |
38 FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE( | |
39 "A file outside the 'lib' directory hierarchy should not reference a file inside that hierarchy. Use a package: reference instead."), | |
40 | |
41 /** | |
42 * It is a bad practice for a package import to reference anything outside the given package, or | |
43 * more generally, it is bad practice for a package import to contain a "..". For example, a | |
44 * source file should not contain a directive such as {@code import 'package:f oo/../some.dart'}. | |
45 */ | |
46 PACKAGE_IMPORT_CONTAINS_DOT_DOT("A package import should not contain '..'"); | |
47 | |
48 /** | |
49 * The message template used to create the message to be displayed for this er ror. | |
50 */ | |
51 private final String message; | |
52 | |
53 /** | |
54 * Initialize a newly created error code to have the given message. | |
55 * | |
56 * @param message the message template used to create the message to be displa yed for the error | |
57 */ | |
58 private PubSuggestionCode(String message) { | |
59 this.message = message; | |
60 } | |
61 | |
62 @Override | |
63 public ErrorSeverity getErrorSeverity() { | |
64 return ErrorType.PUB_SUGGESTION.getSeverity(); | |
65 } | |
66 | |
67 @Override | |
68 public String getMessage() { | |
69 return message; | |
70 } | |
71 | |
72 @Override | |
73 public ErrorType getType() { | |
74 return ErrorType.PUB_SUGGESTION; | |
75 } | |
76 } | |
OLD | NEW |