Skip to content

Commit e9dc622

Browse files
committed
Fix #3 Automated metadata testing + metadata corrections (bulk of work by @rnveach)
1 parent afc1f0f commit e9dc622

File tree

60 files changed

+1398
-572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1398
-572
lines changed
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4+
<attributes>
5+
<attribute name="maven.pomderived" value="true"/>
6+
</attributes>
7+
</classpathentry>
48
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
59
<classpathentry kind="src" path="metadata/"/>
10+
<classpathentry kind="src" path="test"/>
611
<classpathentry exported="true" kind="lib" path="checkstyle-8.10-all.jar" sourcepath="checkstyle-checkstyle-8.10.zip"/>
12+
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
713
<classpathentry kind="output" path="target/classes"/>
814
</classpath>

net.sf.eclipsecs.checkstyle/metadata/com/puppycrawl/tools/checkstyle/checks/annotation/checkstyle-metadata.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ AnnotationUseStyle.trailingArrayComma = Defines the policy for trailing comma in
99

1010
MissingDeprecated.desc = Verifies that both the <code>java.lang.Deprecated</code> annotation is present and the <code>@deprecated<code> Javadoc tag is present when either is present.
1111
MissingDeprecated.name = Missing Deprecated
12+
MissingDeprecated.skipNoJavadoc = When this property is set to true check ignore cases when JavaDoc is missing, but still warns when JavaDoc is present but either @deprecated is missing from JavaDoc or @deprecated is missing from the element.
1213

1314
MissingOverride.desc = Verifies that the <code>java.lang.Override</code> annotation is present when the <code>{@inheritDoc}</code> javadoc tag is present.
1415
MissingOverride.javaFiveCompatibility = When this property is true this check will only check classes, interfaces, etc. that do not contain the extends or implements keyword or are not anonymous classes. This means it only checks methods overridden from java.lang.Object.Java 5 Compatibility mode severely limits this check. It is recommended to only use it on Java 5 source.

net.sf.eclipsecs.checkstyle/metadata/com/puppycrawl/tools/checkstyle/checks/annotation/checkstyle-metadata.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<rule-metadata name="%MissingDeprecated.name" internal-name="MissingDeprecated" parent="TreeWalker">
4444
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck" />
4545
<description>%MissingDeprecated.desc</description>
46+
<property-metadata name="skipNoJavadoc" datatype="Boolean" default-value="false">
47+
<description>%MissingDeprecated.skipNoJavadoc</description>
48+
</property-metadata>
4649
<message-key key="annotation.missing.deprecated" />
4750
<message-key key="javadoc.duplicateTag" />
4851
<message-key key="javadoc.missing" />
@@ -51,7 +54,7 @@
5154
<rule-metadata name="%MissingOverride.name" internal-name="MissingOverride" parent="TreeWalker">
5255
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideCheck" />
5356
<description>%MissingOverride.desc</description>
54-
<property-metadata name="javaFiveCompatibility " datatype="Boolean" default-value="false">
57+
<property-metadata name="javaFiveCompatibility" datatype="Boolean" default-value="false">
5558
<description>%MissingOverride.javaFiveCompatibility</description>
5659
</property-metadata>
5760
<message-key key="tag.not.valid.on" />
@@ -102,6 +105,15 @@
102105
<property-value-option value="METHOD_DEF" />
103106
<property-value-option value="CTOR_DEF" />
104107
<property-value-option value="VARIABLE_DEF" />
108+
<property-value-option value="TYPECAST" />
109+
<property-value-option value="DOT" />
110+
<property-value-option value="TYPE_ARGUMENT" />
111+
<property-value-option value="ANNOTATION_DEF" />
112+
<property-value-option value="ANNOTATION_FIELD_DEF" />
113+
<property-value-option value="LITERAL_NEW" />
114+
<property-value-option value="LITERAL_THROWS" />
115+
<property-value-option value="PARAMETER_DEF" />
116+
<property-value-option value="IMPLEMENTS_CLAUSE" />
105117
</enumeration>
106118
</property-metadata>
107119
<property-metadata name="allowSamelineSingleParameterlessAnnotation" datatype="Boolean"

net.sf.eclipsecs.checkstyle/metadata/com/puppycrawl/tools/checkstyle/checks/blocks/checkstyle-metadata.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ EmptyCatchBlock.commentFormat = The format of the first comment inside empty cat
1717
LeftCurly.desc = Checks for the placement of left curly braces (<code>'{'</code>) for code blocks.<br/>\r\nThe policy to verify is specified using property <code>option</code>.<br/>\r\nPolicies <scode>eol</code> and <code> nlow</code> take into account property <code>maxLineLength</code>.
1818
LeftCurly.name = Left Curly Brace Placement
1919
LeftCurly.option = policy on placement of a left curly brace ('{')
20+
LeftCurly.ignoreEnums = If true, Check will ignore enums when left curly brace policy is EOL
2021
LeftCurly.tokens = blocks to check
2122

2223
NeedBraces.desc = Checks for braces around code blocks.

net.sf.eclipsecs.checkstyle/metadata/com/puppycrawl/tools/checkstyle/checks/blocks/checkstyle-metadata.xml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
<rule-metadata name="%AvoidNestedBlocks.name" internal-name="AvoidNestedBlocks" parent="TreeWalker">
99
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.blocks.AvoidNestedBlocksCheck"/>
10-
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.AvoidNestedBlocksCheck"/>
1110
<description>%AvoidNestedBlocks.desc</description>
1211
<property-metadata name="allowInSwitchCase" datatype="Boolean" default-value="false">
1312
<description>%AvoidNestedBlocks.allowInSwitchCase</description>
@@ -18,14 +17,13 @@
1817

1918
<rule-metadata name="%EmptyBlock.name" internal-name="EmptyBlock" parent="TreeWalker">
2019
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck"/>
21-
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.EmptyBlockCheck"/>
2220
<description>%EmptyBlock.desc</description>
2321
<property-metadata name="option" datatype="SingleSelect" default-value="STATEMENT">
2422
<description>%EmptyBlock.option</description>
2523
<enumeration option-provider="com.puppycrawl.tools.checkstyle.checks.blocks.BlockOption"/>
2624
</property-metadata>
2725
<property-metadata name="tokens" datatype="MultiCheck"
28-
default-value="LITERAL_WHILE, LITERAL_TRY, LITERAL_FINALLY, LITERAL_DO, LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, INSTANCE_INIT, STATIC_INIT, LITERAL_SWITCH, LITERAL_SYNCHRONIZED">
26+
default-value="LITERAL_WHILE,LITERAL_TRY,LITERAL_FINALLY,LITERAL_DO,LITERAL_IF,LITERAL_ELSE,LITERAL_FOR,INSTANCE_INIT,STATIC_INIT,LITERAL_SWITCH,LITERAL_SYNCHRONIZED">
2927
<description>%EmptyBlock.tokens</description>
3028
<enumeration>
3129
<property-value-option value="LITERAL_WHILE"/>
@@ -63,14 +61,16 @@
6361

6462
<rule-metadata name="%LeftCurly.name" internal-name="LeftCurly" parent="TreeWalker">
6563
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck"/>
66-
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.LeftCurlyCheck"/>
6764
<description>%LeftCurly.desc</description>
6865
<property-metadata name="option" datatype="SingleSelect" default-value="eol">
6966
<description>%LeftCurly.option</description>
7067
<enumeration option-provider="com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyOption"/>
7168
</property-metadata>
69+
<property-metadata name="ignoreEnums" datatype="Boolean" default-value="true">
70+
<description>%LeftCurly.ignoreEnums</description>
71+
</property-metadata>
7272
<property-metadata name="tokens" datatype="MultiCheck"
73-
default-value="INTERFACE_DEF,CLASS_DEF,ANNOTATION_DEF,ENUM_DEF,CTOR_DEF,METHOD_DEF,ENUM_CONSTANT_DEF,LITERAL_WHILE,LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,LITERAL_SYNCHRONIZED,LITERAL_SWITCH,LITERAL_DO,LITERAL_IF,LITERAL_ELSE,LITERAL_FOR">
73+
default-value="INTERFACE_DEF,CLASS_DEF,ANNOTATION_DEF,ENUM_DEF,CTOR_DEF,METHOD_DEF,ENUM_CONSTANT_DEF,LITERAL_WHILE,LITERAL_TRY,LITERAL_CATCH,LITERAL_FINALLY,LITERAL_SYNCHRONIZED,LITERAL_SWITCH,LITERAL_DO,LITERAL_IF,LITERAL_ELSE,LITERAL_FOR,STATIC_INIT,OBJBLOCK,LAMBDA">
7474
<description>%LeftCurly.tokens</description>
7575
<enumeration>
7676
<property-value-option value="INTERFACE_DEF"/>
@@ -80,6 +80,7 @@
8080
<property-value-option value="CTOR_DEF"/>
8181
<property-value-option value="METHOD_DEF"/>
8282
<property-value-option value="ENUM_CONSTANT_DEF"/>
83+
<property-value-option value="LAMBDA"/>
8384
<property-value-option value="LITERAL_WHILE"/>
8485
<property-value-option value="LITERAL_TRY"/>
8586
<property-value-option value="LITERAL_CATCH"/>
@@ -90,25 +91,30 @@
9091
<property-value-option value="LITERAL_IF"/>
9192
<property-value-option value="LITERAL_ELSE"/>
9293
<property-value-option value="LITERAL_FOR"/>
94+
<property-value-option value="OBJBLOCK"/>
95+
<property-value-option value="STATIC_INIT"/>
9396
</enumeration>
9497
</property-metadata>
9598
<message-key key="line.new"/>
9699
<message-key key="line.previous"/>
100+
<message-key key="line.break.after"/>
97101
</rule-metadata>
98102

99103
<rule-metadata name="%NeedBraces.name" internal-name="NeedBraces" parent="TreeWalker">
100104
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck"/>
101-
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.NeedBracesCheck"/>
102105
<description>%NeedBraces.desc</description>
103106
<property-metadata name="tokens" datatype="MultiCheck"
104-
default-value="LITERAL_DO,LITERAL_ELSE,LITERAL_IF,LITERAL_FOR,LITERAL_WHILE">
107+
default-value="LITERAL_DO,LITERAL_ELSE,LITERAL_FOR,LITERAL_IF,LITERAL_WHILE">
105108
<description>%NeedBraces.tokens</description>
106109
<enumeration>
107110
<property-value-option value="LITERAL_DO"/>
108111
<property-value-option value="LITERAL_ELSE"/>
109112
<property-value-option value="LITERAL_IF"/>
110113
<property-value-option value="LITERAL_FOR"/>
111114
<property-value-option value="LITERAL_WHILE"/>
115+
<property-value-option value="LITERAL_DEFAULT"/>
116+
<property-value-option value="LITERAL_CASE"/>
117+
<property-value-option value="LAMBDA"/>
112118
</enumeration>
113119
</property-metadata>
114120
<property-metadata name="allowSingleLineStatement" datatype="Boolean" default-value="false">
@@ -123,7 +129,6 @@
123129

124130
<rule-metadata name="%RightCurly.name" internal-name="RightCurly" parent="TreeWalker">
125131
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck"/>
126-
<alternative-name internal-name="com.puppycrawl.tools.checkstyle.checks.RightCurlyCheck"/>
127132
<description>%RightCurly.desc</description>
128133
<property-metadata name="option" datatype="SingleSelect" default-value="same">
129134
<description>%RightCurly.option</description>
@@ -155,6 +160,7 @@
155160
<message-key key="line.alone"/>
156161
<message-key key="line.same"/>
157162
<message-key key="line.new"/>
163+
<message-key key="line.break.before"/>
158164
</rule-metadata>
159165

160166

net.sf.eclipsecs.checkstyle/metadata/com/puppycrawl/tools/checkstyle/checks/checkstyle-metadata.properties

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,19 @@ DescendantToken.minimumMessage = error message when minimum count not reached
1313
DescendantToken.minimumNumber = a minimum count for descendants
1414
DescendantToken.name = Descendent Token Check
1515
DescendantToken.sumTokenCounts = whether the number of tokens found should be calculated from the sum of the individual token counts
16-
DescendantToken.tokens = Tokens to check.
1716

1817
FinalParameters.desc = Check that method/constructor parameters are final. Interface methods are not checked - the final keyword does not make sense for interface method parameters as there is no code that could modify the parameter.<br/>\r\nRationale: Changing the value of parameters during the execution of the method's algorithm can be confusing and should be avoided. A great way to let the Java compiler prevent this coding style is to declare parameters final.
1918
FinalParameters.name = Final Parameters
2019
FinalParameters.tokens = Tokens to check.
2120
FinalParameters.ignorePrimitiveTypes = ignore primitive types as parameters
2221
23-
GenericIllegalRegexp.desc = A generic check for code problems - the user can search for any pattern. This is similar to a recursive grep, only that it's integrated in checkstyle.<br/>\r\nRationale: This check can be used to prototype checks and to find common bad practice such as calling <code>ex.printStacktrace()</code>, <code>System.out.println()</code>, <code>System.exit()</code>, etc.
24-
GenericIllegalRegexp.format = Pattern to check for.
25-
GenericIllegalRegexp.ignoreCase = Controls whether to ignore case when searching.
26-
GenericIllegalRegexp.ignoreComments = Controls whether to ignore text in comments when searching.
27-
GenericIllegalRegexp.message = Message which is used to notify about violations, if empty then default(hard-coded) message is used.
28-
GenericIllegalRegexp.name = Generic Illegal Regexp
29-
30-
Indentation.basicOffset = how many spaces to use for new indentation level
31-
Indentation.braceAdjustment = how far brace should be indented when on next line
32-
Indentation.caseIndent = how much to indent a case label
33-
Indentation.desc = Checks correct indentation of Java Code.<br/>\r\nThe basic idea behind this is that while pretty printers are sometimes convienent for bulk reformats of legacy code, they often either aren't configurable enough or just can't anticipate how format should be done. Sometimes this is personal preference, other times it is practical experience. In any case, this check should just ensure that a minimal set of indentation rules are followed.
34-
Indentation.name = Indentation
35-
Indentation.throwsIndent = how far throws should be indented when on next line
36-
Indentation.arrayInitIndent = how much to indent an array initialization when on next line
37-
Indentation.lineWrappingIndentation = how far continuation line should be indented when line-wrapping is present
38-
Indentation.forceStrictCondition = force strict condition in line wrapping case. If value is true, line wrap indent have to be same as lineWrappingIndentation parameter
39-
40-
CommentsIndentation.name = Comments Indentation
41-
CommentsIndentation.desc = Controls the indentation between comments and surrounding code. Comments are indented at the same level as the surrounding code. Detailed info about such convention can be found <a href="http://checkstyle.sourceforge.net/reports/google-java-style.html#s4.8.6.1-block-comment-style">here</a>.
42-
CommentsIndentation.tokens = tokens to check
43-
4422
Miscellaneous.group = Miscellaneous
4523
4624
NewlineAtEndOfFile.desc = Checks whether files end with a new line.<br/>\r\nRationale: Any source files and text files in general should end with a newline character, especially when using SCM systems such as CVS. CVS will even print a warning when it encounters a file that doesn't end with a newline.
4725
NewlineAtEndOfFile.fileExtensions = file type extension of the files to check.
4826
NewlineAtEndOfFile.lineSeparator = type of line separator
4927
NewlineAtEndOfFile.name = New Line At End Of File
5028

51-
RequiredRegexp.desc = A check that makes sure that a specified pattern exists in the code, e.g. a required legal text. It does not care about where in the file the pattern is
52-
RequiredRegexp.format = required pattern
53-
RequiredRegexp.name = Required Regular Expression
54-
5529
TodoComment.desc = A check for TODO: comments. Actually it is a generic regular expression matcher on Java comments. To check for other patterns in Java comments, set property format.
5630
TodoComment.format = Regular expression definging pattern to look for.
5731
TodoComment.name = Todo Comment
@@ -86,4 +60,8 @@ AvoidEscapedUnicodeCharacters.allowNonPrintableEscapes = Allow non-printable esc
8660

8761
UniqueProperties.name = Unique Properties
8862
UniqueProperties.desc = Checks properties file for a duplicated properties.<br/><br/>Rationale: Multiple property keys usually appears after merge or rebase of several branches. While there is no errors in runtime, there can be a confusion on having different values for the duplicated properties.
89-
UniqueProperties.fileExtensions = file type extension of the files to check.
63+
UniqueProperties.fileExtensions = file type extension of the files to check.
64+
65+
SuppressWarningsHolder.name = SuppressWarningsHolder
66+
SuppressWarningsHolder.desc = Maintains a set of check suppressions from {@link SuppressWarnings} annotations.
67+
SuppressWarningsHolder.aliasList = the list of comma-separated alias assignments

0 commit comments

Comments
 (0)