summaryrefslogtreecommitdiff
path: root/thirdparty/checkstyle/contrib/JavadocCheckDefault.java
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /thirdparty/checkstyle/contrib/JavadocCheckDefault.java
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'thirdparty/checkstyle/contrib/JavadocCheckDefault.java')
-rwxr-xr-xthirdparty/checkstyle/contrib/JavadocCheckDefault.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/thirdparty/checkstyle/contrib/JavadocCheckDefault.java b/thirdparty/checkstyle/contrib/JavadocCheckDefault.java
new file mode 100755
index 000000000..11a126d90
--- /dev/null
+++ b/thirdparty/checkstyle/contrib/JavadocCheckDefault.java
@@ -0,0 +1,62 @@
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+
+import com.puppycrawl.tools.checkstyle.api.Check;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+
+/**
+ * Tool that generates Javadoc description of the default tokens for a Check.
+ * @author Rick Giles
+ * @version 27-Nov-2002
+ */
+public class JavadocCheckDefault
+{
+
+ private static void usage()
+ {
+ System.out.println("Usage: java JavadocCheckDefault check element");
+ System.exit(0);
+ }
+
+ public static void main(String[] args)
+ {
+ if (args.length < 2) {
+ usage();
+ }
+ final String header =
+ " * <p> By default the check will check the following "
+ + args[1] + ":\n";
+ final String footer = ".\n * </p>\n";
+ final String prefix = " * {@link TokenTypes#";
+
+ try {
+ final Class clazz = Class.forName(args[0]);
+ final Check check = (Check) clazz.newInstance();
+ final int[] defaultTokens = check.getDefaultTokens();
+ if (defaultTokens.length > 0) {
+ final StringBuffer buf = new StringBuffer();
+ buf.append(header);
+ final ArrayList tokenNames = new ArrayList();
+ for (int i = 0; i < defaultTokens.length; i++) {
+ tokenNames.add(TokenTypes.getTokenName(defaultTokens[i]));
+ }
+ Collections.sort(tokenNames);
+ final Iterator it = tokenNames.iterator();
+ String token = (String) it.next();
+ buf.append(prefix + token + " " + token + "}");
+ while (it.hasNext()) {
+ token = (String) it.next();
+ buf.append(",\n" + prefix + token + " " + token + "}");
+ }
+ buf.append(footer);
+ System.out.println(buf);
+ }
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(0);
+ }
+ }
+}