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

Unified Diff: third_party/WebKit/Source/devtools/scripts/jsdoc_validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java

Issue 2441163002: DevTools: clean up scripts folder (Closed)
Patch Set: Fix sys.path for chromevox to load rjsmin 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
Index: third_party/WebKit/Source/devtools/scripts/jsdoc_validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java
diff --git a/third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java b/third_party/WebKit/Source/devtools/scripts/jsdoc_validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java
similarity index 86%
rename from third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java
rename to third_party/WebKit/Source/devtools/scripts/jsdoc_validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java
index 6c75a2ab19f4585fb791058dfb4512c16a941bb1..4c7244b5b34f8b068e31d5adabc953808c8db774 100644
--- a/third_party/WebKit/Source/devtools/scripts/jsdoc-validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java
+++ b/third_party/WebKit/Source/devtools/scripts/jsdoc_validator/src/org/chromium/devtools/jsdoc/checks/MethodAnnotationChecker.java
@@ -12,7 +12,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class MethodAnnotationChecker extends ContextTrackingChecker {
-
private static final Pattern PARAM_PATTERN =
Pattern.compile("^[^@\n]*@param\\s+(\\{.+\\}\\s+)?([^\\s]+).*$", Pattern.MULTILINE);
@@ -25,17 +24,17 @@ public final class MethodAnnotationChecker extends ContextTrackingChecker {
@Override
public void enterNode(Node node) {
switch (node.getType()) {
- case Token.FUNCTION:
- handleFunction(node);
- break;
- case Token.RETURN:
- handleReturn(node);
- break;
- case Token.THROW:
- handleThrow();
- break;
- default:
- break;
+ case Token.FUNCTION:
+ handleFunction(node);
+ break;
+ case Token.RETURN:
+ handleReturn(node);
+ break;
+ case Token.THROW:
+ handleThrow();
+ break;
+ default:
+ break;
}
}
@@ -46,10 +45,9 @@ public final class MethodAnnotationChecker extends ContextTrackingChecker {
}
String[] nonAnnotatedParams = getNonAnnotatedParamData(function);
if (nonAnnotatedParams.length > 0
- && function.parameterNames.size() != nonAnnotatedParams.length) {
+ && function.parameterNames.size() != nonAnnotatedParams.length) {
reportErrorAtOffset(function.info.getOriginalCommentPosition(),
- String.format(
- "No @param JSDoc tag found for parameters: [%s]",
+ String.format("No @param JSDoc tag found for parameters: [%s]",
Joiner.on(',').join(nonAnnotatedParams)));
}
}
@@ -71,8 +69,7 @@ public final class MethodAnnotationChecker extends ContextTrackingChecker {
String paramType = m.group(1);
if (paramType == null) {
reportErrorAtOffset(function.info.getOriginalCommentPosition() + m.start(2),
- String.format(
- "Invalid @param annotation found -"
+ String.format("Invalid @param annotation found -"
+ " should be \"@param {<type>} paramName\""));
} else {
formalParamNames.remove(m.group(2));
@@ -131,14 +128,14 @@ public final class MethodAnnotationChecker extends ContextTrackingChecker {
functionName = parts[parts.length - 1];
boolean isApiFunction = !functionName.startsWith("_")
&& (function.isTopLevelFunction()
- || (function.enclosingType != null
- && isPlainTopLevelFunction(function.enclosingFunctionRecord)));
+ || (function.enclosingType != null
+ && isPlainTopLevelFunction(
+ function.enclosingFunctionRecord)));
boolean isReturningFunction = valueReturningFunctions.contains(function);
boolean isInterfaceFunction =
function.enclosingType != null && function.enclosingType.isInterface();
- int invalidAnnotationIndex =
- invalidReturnAnnotationIndex(function.info);
+ int invalidAnnotationIndex = invalidReturnAnnotationIndex(function.info);
if (invalidAnnotationIndex != -1) {
String suggestedResolution = (isReturningFunction || isInterfaceFunction)
? "should be \"@return {<type>}\""
@@ -156,15 +153,13 @@ public final class MethodAnnotationChecker extends ContextTrackingChecker {
if (isReturningFunction) {
if (!function.isConstructor() && !function.hasReturnAnnotation() && isApiFunction) {
- reportErrorAtNodeStart(
- functionNameNode,
+ reportErrorAtNodeStart(functionNameNode,
"@return annotation is required for API functions that return value");
}
} else {
// A @return-function that does not actually return anything and
// is intended to be overridden in subclasses must throw.
- if (function.hasReturnAnnotation()
- && !isInterfaceFunction
+ if (function.hasReturnAnnotation() && !isInterfaceFunction
&& !throwingFunctions.contains(function)) {
reportErrorAtNodeStart(functionNameNode,
"@return annotation found, yet function does not return value");

Powered by Google App Engine
This is Rietveld 408576698