From 0345245e860375a32c9a437c4a9d9cae807134e9 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 29 May 2017 12:40:26 +0530 Subject: CMSCOPE changed --- .../checkstyle/contrib/JavadocCheckDefault.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 thirdparty/checkstyle/contrib/JavadocCheckDefault.java (limited to 'thirdparty/checkstyle/contrib/JavadocCheckDefault.java') 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 = + " *
By default the check will check the following " + + args[1] + ":\n"; + final String footer = ".\n *
\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); + } + } +} -- cgit