Skip to content

Commit 397e044

Browse files
committed
checkstyle
1 parent bb25b79 commit 397e044

File tree

5 files changed

+251
-1
lines changed

5 files changed

+251
-1
lines changed

dev/java.header

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/

dev/javastyle-config.xml

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one or more
3+
~ contributor license agreements. See the NOTICE file distributed with
4+
~ this work for additional information regarding copyright ownership.
5+
~ The ASF licenses this file to You under the Apache License, Version 2.0
6+
~ (the "License"); you may not use this file except in compliance with
7+
~ the License. You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<!DOCTYPE module PUBLIC
19+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
20+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
21+
22+
<!--
23+
24+
Checkstyle configuration based on the Google coding conventions from:
25+
26+
- Google Java Style
27+
https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html
28+
29+
with Spark-specific changes from:
30+
31+
https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide
32+
33+
Checkstyle is very configurable. Be sure to read the documentation at
34+
http://checkstyle.sf.net (or in your downloaded distribution).
35+
36+
Most Checks are configurable, be sure to consult the documentation.
37+
38+
To completely disable a check, just comment it out or delete it from the file.
39+
40+
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
41+
42+
-->
43+
44+
<module name = "Checker">
45+
<property name="charset" value="UTF-8"/>
46+
47+
<property name="severity" value="error"/>
48+
49+
<property name="fileExtensions" value="java, properties, xml"/>
50+
51+
<!-- Checks for whitespace -->
52+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
53+
<module name="FileTabCharacter">
54+
<property name="eachLine" value="true"/>
55+
</module>
56+
57+
<module name="RegexpSingleline">
58+
<!-- \s matches whitespace character, $ matches end of line. -->
59+
<property name="format" value="\s+$"/>
60+
<property name="message" value="No trailing whitespace allowed."/>
61+
</module>
62+
63+
<module name="Header">
64+
<property name="headerFile" value="${checkstyle.header.file}"/>
65+
<property name="fileExtensions" value="java"/>
66+
</module>
67+
68+
<module name="TreeWalker">
69+
<module name="OuterTypeFilename"/>
70+
<module name="IllegalTokenText">
71+
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
72+
<property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
73+
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
74+
</module>
75+
<module name="AvoidEscapedUnicodeCharacters">
76+
<property name="allowEscapesForControlCharacters" value="true"/>
77+
<property name="allowByTailComment" value="true"/>
78+
<property name="allowNonPrintableEscapes" value="true"/>
79+
</module>
80+
<!-- TODO: 11/09/15 disabled - the lengths are currently > 100 in many places -->
81+
82+
<!--<module name="LineLength">-->
83+
<!--<property name="max" value="100"/>-->
84+
<!--<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>-->
85+
<!--</module>-->
86+
87+
<module name="NoLineWrap"/>
88+
<module name="EmptyBlock">
89+
<property name="option" value="TEXT"/>
90+
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
91+
</module>
92+
<module name="NeedBraces">
93+
<property name="allowSingleLineStatement" value="true"/>
94+
</module>
95+
<module name="OneStatementPerLine"/>
96+
<module name="ArrayTypeStyle"/>
97+
<module name="FallThrough"/>
98+
<module name="UpperEll"/>
99+
<module name="ModifierOrder"/>
100+
<module name="SeparatorWrap">
101+
<property name="tokens" value="DOT"/>
102+
<property name="option" value="nl"/>
103+
</module>
104+
<module name="SeparatorWrap">
105+
<property name="tokens" value="COMMA"/>
106+
<property name="option" value="EOL"/>
107+
</module>
108+
<module name="PackageName">
109+
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
110+
<message key="name.invalidPattern"
111+
value="Package name ''{0}'' must match pattern ''{1}''."/>
112+
</module>
113+
<module name="ClassTypeParameterName">
114+
<property name="format" value="([A-Z][a-zA-Z0-9]*$)"/>
115+
<message key="name.invalidPattern"
116+
value="Class type name ''{0}'' must match pattern ''{1}''."/>
117+
</module>
118+
<module name="MethodTypeParameterName">
119+
<property name="format" value="([A-Z][a-zA-Z0-9]*)"/>
120+
<message key="name.invalidPattern"
121+
value="Method type name ''{0}'' must match pattern ''{1}''."/>
122+
</module>
123+
<module name="NoFinalizer"/>
124+
<module name="GenericWhitespace">
125+
<message key="ws.followed"
126+
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
127+
<message key="ws.preceded"
128+
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
129+
<message key="ws.illegalFollow"
130+
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
131+
<message key="ws.notPreceded"
132+
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
133+
</module>
134+
<!--<module name="Indentation">-->
135+
<!--<property name="basicOffset" value="2"/>-->
136+
<!--<property name="braceAdjustment" value="0"/>-->
137+
<!--<property name="caseIndent" value="2"/>-->
138+
<!--<property name="throwsIndent" value="2"/>-->
139+
<!--<property name="lineWrappingIndentation" value="4"/>-->
140+
<!--<property name="arrayInitIndent" value="4"/>-->
141+
<!--</module>-->
142+
143+
<!-- TODO: 11/09/15 disabled - order is currently wrong in many places -->
144+
145+
<module name="ImportOrder">
146+
<property name="separated" value="true"/>
147+
<!--<property name="ordered" value="true"/>-->
148+
<property name="groups" value="/^javax?\./,org.apache.carbondata,*"/>
149+
</module>
150+
151+
<module name="MethodParamPad"/>
152+
<module name="AnnotationLocation">
153+
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
154+
</module>
155+
<module name="AnnotationLocation">
156+
<property name="tokens" value="VARIABLE_DEF"/>
157+
<property name="allowSamelineMultipleAnnotations" value="true"/>
158+
</module>
159+
<module name="MethodName">
160+
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
161+
<message key="name.invalidPattern"
162+
value="Method name ''{0}'' must match pattern ''{1}''."/>
163+
</module>
164+
<module name="EmptyCatchBlock">
165+
<property name="exceptionVariableName" value="expected"/>
166+
</module>
167+
<module name="CommentsIndentation"/>
168+
<module name="UnusedImports"/>
169+
170+
<module name="ParenPad"/>
171+
<module name="WhitespaceAround"/>
172+
</module>
173+
</module>

dev/javastyle-suppressions.xml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one or more
3+
~ contributor license agreements. See the NOTICE file distributed with
4+
~ this work for additional information regarding copyright ownership.
5+
~ The ASF licenses this file to You under the Apache License, Version 2.0
6+
~ (the "License"); you may not use this file except in compliance with
7+
~ the License. You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<!DOCTYPE suppressions PUBLIC
19+
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
20+
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
21+
22+
<!--
23+
24+
This file contains suppression rules for Checkstyle checks.
25+
Ideally only files that cannot be modified (e.g. third-party code)
26+
should be added here. All other violations should be fixed.
27+
28+
-->
29+
30+
<suppressions>
31+
<suppress checks=".*"
32+
files="org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java"/>
33+
</suppressions>

flinkx-core/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<properties>
1515
<scala.binary.version>2.10</scala.binary.version>
1616
<flink.version>1.4.0</flink.version>
17+
<dev.path>${basedir}/../dev</dev.path>
1718
</properties>
1819

1920
<dependencies>

pom.xml

+28-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<properties>
3232
<scala.binary.version>2.10</scala.binary.version>
3333
<flink.version>1.4.0</flink.version>
34+
<dev.path>${basedir}/dev</dev.path>
3435
</properties>
3536

3637
<build>
@@ -56,7 +57,6 @@
5657
</execution>
5758
</executions>
5859
</plugin>
59-
6060
<plugin>
6161
<groupId>org.apache.maven.plugins</groupId>
6262
<artifactId>maven-javadoc-plugin</artifactId>
@@ -66,7 +66,34 @@
6666
<destDir>flinkx-java-docs</destDir>
6767
</configuration>
6868
</plugin>
69+
<!--checkstyle-->
70+
<!--<plugin>-->
71+
<!--<groupId>org.apache.maven.plugins</groupId>-->
72+
<!--<artifactId>maven-checkstyle-plugin</artifactId>-->
73+
<!--<version>2.17</version>-->
74+
<!--<configuration>-->
75+
<!--<configLocation>${dev.path}/javastyle-config.xml</configLocation>-->
76+
<!--<suppressionsLocation>${dev.path}/javastyle-suppressions.xml</suppressionsLocation>-->
77+
<!--<headerLocation>${dev.path}/java.header</headerLocation>-->
78+
<!--<consoleOutput>true</consoleOutput>-->
79+
<!--<failsOnError>true</failsOnError>-->
80+
<!--<linkXRef>false</linkXRef>-->
81+
<!--<failOnViolation>true</failOnViolation>-->
82+
<!--<includeTestSourceDirectory>false</includeTestSourceDirectory>-->
83+
<!--<sourceDirectory>${basedir}/src/main/java</sourceDirectory>-->
84+
<!--<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>-->
85+
<!--<outputFile>${basedir}/target/checkstyle-output.xml</outputFile>-->
86+
<!--</configuration>-->
87+
<!--<executions>-->
88+
<!--<execution>-->
89+
<!--<goals>-->
90+
<!--<goal>check</goal>-->
91+
<!--</goals>-->
92+
<!--</execution>-->
93+
<!--</executions>-->
94+
<!--</plugin>-->
6995
</plugins>
96+
7097
</build>
7198

7299
</project>

0 commit comments

Comments
 (0)