Skip to content

Commit aa9d3d3

Browse files
HuGanghuiromani
authored andcommitted
Issue #251: ci:build patch-filter jar buring a build
1 parent a21ba17 commit aa9d3d3

13 files changed

+1181
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ net.sf.eclipsecs.core/lib/metadata-gen-1.0-SNAPSHOT.jar
66
*.iml
77
*.prefs
88
.checkstyle
9+
net.sf.eclipsecs.core/lib/patch-filter-1.0-SNAPSHOT.jar
10+
target/
11+
patch-filters/

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ matrix:
2727
- jdk: openjdk8
2828
env:
2929
- DESC="install (openjdk8)"
30-
- CMD="./build-metafile-gen.sh && mvn install && git diff"
30+
- CMD="./build-metafile-gen.sh && ./build-patch-filter.sh && mvn install && git diff"
3131

3232
# JDK 11 (Long Term Support version)
3333
- jdk: openjdk11
3434
env:
3535
- DESC="install (openjdk11)"
36-
- CMD="./build-metafile-gen.sh && mvn install && git diff"
36+
- CMD="./build-metafile-gen.sh && ./build-patch-filter.sh && mvn install && git diff"
3737

3838
# JDK 13 (most recent Java version)
3939
- jdk: openjdk13
4040
env:
4141
- DESC="install (openjdk13)"
42-
- CMD="./build-metafile-gen.sh && mvn install && git diff"
42+
- CMD="./build-metafile-gen.sh && ./build-patch-filter.sh && mvn install && git diff"
4343

4444
script:
4545
- |

build-patch-filter.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
mkdir target
5+
git diff HEAD~1 HEAD > target/show.patch
6+
7+
rm -rf patch-filters
8+
git clone https://github.com/checkstyle/patch-filters
9+
cd patch-filters
10+
mvn install -DskipTests

config/checkstyle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
checkstyle.suppressions.file=config/suppressions.xml
2+
checkstyle.suppressions-xpath.file=config/suppressions.xml
3+
checkstyle.header.file=config/java.header
4+
checkstyle.regexp.header.file=config/java_regexp.header
5+
checkstyle.importcontrol.file=config/import-control.xml
6+
checkstyle.importcontroltest.file=config/import-control-test.xml

config/checkstyle_checks.xml

Lines changed: 801 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
<?xml version="1.0" ?>
2+
3+
<!DOCTYPE module PUBLIC
4+
"-//Checkstyle//DTD Checkstyle Configuration 1.2//EN"
5+
"https://checkstyle.org/dtds/configuration_1_2.dtd">
6+
7+
<module name="Checker">
8+
<!-- All checks are from https://github.com/sevntu-checkstyle/sevntu.checkstyle project -->
9+
10+
<!-- Filters -->
11+
<module name="SuppressionFilter">
12+
<property name="file" value="config/sevntu_suppressions.xml"/>
13+
</module>
14+
15+
<module name="com.puppycrawl.tools.checkstyle.filters.SuppressionPatchFilter">
16+
<property name="file" value="target/show.patch"/>
17+
<property name="strategy" value="patchedline" />
18+
</module>
19+
20+
<module name="TreeWalker">
21+
<module name="com.puppycrawl.tools.checkstyle.filters.SuppressionJavaPatchFilter">
22+
<property name="file" value="target/show.patch"/>
23+
<property name="strategy" value="patchedline" />
24+
</module>
25+
26+
<module name="SuppressWithNearbyCommentFilter">
27+
<property name="commentFormat" value="-@cs\[(\w{8,})\] \w[\(\)\-\.\'\`\,\:\;\w ]{10,}"/>
28+
<property name="checkFormat" value="$1"/>
29+
<property name="influenceFormat" value="3"/>
30+
</module>
31+
<module name="StaticMethodCandidate"/>
32+
<module name="UselessSingleCatchCheck"/>
33+
<module name="NestedSwitchCheck"/>
34+
<module name="CauseParameterInException"/>
35+
<module name="NameConventionForJunit4TestClassesCheck"/>
36+
<module name="EmptyPublicCtorInClassCheck"/>
37+
<module name="TernaryPerExpressionCount"/>
38+
<module name="ReturnNullInsteadOfBoolean"/>
39+
<module name="ReturnBooleanFromTernary"/>
40+
<module name="PublicReferenceToPrivateTypeCheck"/>
41+
<module name="NoNullForCollectionReturnCheck"/>
42+
<module name="NoMainMethodInAbstractClass"/>
43+
<module name="com.github.sevntu.checkstyle.checks.naming.InterfaceTypeParameterNameCheck"/>
44+
<module name="ForbidThrowAnonymousExceptionsCheck"/>
45+
<module name="ForbidReturnInFinallyBlock"/>
46+
<module name="ForbidInstantiation">
47+
<property name="forbiddenClasses" value="java.lang.NullPointerException,
48+
java.util.Vector, java.util.Stack,com.google.collect.Iterables,
49+
com.google.common.primitives.Ints,com.google.common.base.String,
50+
com.google.common.base.Function,com.google.common.base.Supplier,
51+
com.google.common.base.Charsets,com.google.common.base.MoreObjects,
52+
com.google.common.base.Optional,com.google.common.base.Equivalence,
53+
com.google.common.base.Preconditions,com.google.common.base.Predicate,
54+
com.google.common.io.CharSource,com.google.common.annotations.Beta,
55+
com.google.common.collect.Queues,com.google.common.collect.Sets,
56+
com.google.common.collect.Lists,com.google.common.annotations.GwtCompatible,
57+
com.google.common.io.Files,com.google.common.collect.TreeTraverser"/>
58+
</module>
59+
<module name="ForbidCCommentsInMethods"/>
60+
<module name="FinalizeImplementationCheck"/>
61+
<module name="RequiredParameterForAnnotation"/>
62+
<module name="DiamondOperatorForVariableDefinitionCheck"/>
63+
<module name="ConfusingConditionCheck"/>
64+
<module name="AvoidDefaultSerializableInInnerClasses"/>
65+
<module name="UselessSuperCtorCallCheck"/>
66+
<module name="UnnecessaryParenthesesExtended">
67+
<property name="ignoreCalculationOfBooleanVariables" value="true"/>
68+
<property name="ignoreCalculationOfBooleanVariablesWithReturn" value="true"/>
69+
<property name="ignoreCalculationOfBooleanVariablesWithAssert" value="true"/>
70+
</module>
71+
<module name="MultipleVariableDeclarationsExtended">
72+
<property name="ignoreCycles" value="true"/>
73+
<property name="ignoreMethods" value="true"/>
74+
</module>
75+
<module name="ChildBlockLength">
76+
<property name="blockTypes"
77+
value="LITERAL_IF,LITERAL_ELSE,LITERAL_WHILE,LITERAL_DO,
78+
LITERAL_FOR,LITERAL_SWITCH,LITERAL_TRY,LITERAL_CATCH"/>
79+
</module>
80+
<module name="MapIterationInForEachLoop">
81+
<property name="proposeKeySetUsage" value="true"/>
82+
<property name="proposeEntrySetUsage" value="true"/>
83+
</module>
84+
85+
<!-- Might cause problems related to issue:
86+
https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/352 -->
87+
<module name="AvoidConstantAsFirstOperandInConditionCheck">
88+
<property name="targetConstantTypes"
89+
value="LITERAL_NULL,LITERAL_TRUE,LITERAL_FALSE,
90+
NUM_INT,NUM_DOUBLE,NUM_LONG,NUM_FLOAT"/>
91+
</module>
92+
<module name="EitherLogOrThrowCheck"/>
93+
<module name="IllegalCatchExtended">
94+
<property name="allowRethrow" value="true"/>
95+
</module>
96+
<module name="AvoidNotShortCircuitOperatorsForBoolean"/>
97+
<module name="RedundantReturn"/>
98+
<module name="WhitespaceBeforeArrayInitializer"/>
99+
<module name="InnerClass"/>
100+
<module name="EnumValueNameCheck">
101+
<property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
102+
</module>
103+
<module name="OverridableMethodInConstructor">
104+
<property name="checkCloneMethod" value="true"/>
105+
<property name="checkReadObjectMethod" value="true"/>
106+
<property name="matchMethodsByArgCount" value="true"/>
107+
</module>
108+
<module name="ForbidAnnotation">
109+
<property name="annotationNames" value="Ignore, VisibleForTesting"/>
110+
<property name="annotationTargets" value="METHOD_DEF"/>
111+
</module>
112+
<module name="RequiredParameterForAnnotation">
113+
<property name="annotationName" value="Generated"/>
114+
<property name="requiredParameters" value="value"/>
115+
</module>
116+
<module name="ForbidCertainImports">
117+
<property name="packageNameRegexp" value=".+"/>
118+
<property name="forbiddenImportsRegexp" value="java\.util\.Stack|java\.util\.Vector|
119+
com\.google\.collect\.Iterables|com\.google\.common\.annotations\.Beta|
120+
com\.google\.common\.base\.Predicate|com\.google\.common\.base\.String|
121+
com\.google\.common\.base\.Function|com\.google\.common\.base\.Supplier|
122+
com\.google\.common\.base\.Charsets|com\.google\.common\.base\.MoreObjects|
123+
com\.google\.common\.base\.Equivalence|com\.google\.common\.base\.Preconditions|
124+
com\.google\.common\.base\.Optional|com\.google\.common\.io\.CharSource|
125+
com\.google\.common\.primitives.*|com\.google\.common\.collect\.Sets|
126+
com\.google\.common\.collect\.Queues|com\.google\.common\.collect\.Lists|
127+
com\.google\.common\.annotations\.GwtCompatible|com\.google\.common\.io\.Files|
128+
com\.google\.common\.collect\.TreeTraverser"/>
129+
<property name="forbiddenImportsExcludesRegexp" value=""/>
130+
</module>
131+
<module name="ForbidCertainImports">
132+
<property name="packageNameRegexp"
133+
value=".+\.checkstyle\.api.*|.+\.checkstyle\.utils.*"/>
134+
<property name="forbiddenImportsRegexp" value=".+\.checks\..+"/>
135+
<!-- AccessModifier is in util package (should be moved to api package) to disallow
136+
its usage by API clients till https://github.com/checkstyle/checkstyle/issues/3511 -->
137+
<property name="forbiddenImportsExcludesRegexp"
138+
value="^com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption$"/>
139+
</module>
140+
<module name="LineLengthExtended">
141+
<property name="max" value="100"/>
142+
<property name="ignoreClass" value="true"/>
143+
<property name="ignoreConstructor" value="true"/>
144+
<property name="ignoreField" value="true"/>
145+
<property name="ignoreMethod" value="true"/>
146+
<property name="ignorePattern" value="^( *\* *[^ ]+)|((package|import) .*)$"/>
147+
</module>
148+
<module name="AvoidHidingCauseException"/>
149+
<module name="MultipleStringLiteralsExtended">
150+
<property name="highlightAllDuplicates" value="true"/>
151+
</module>
152+
<module name="SimpleAccessorNameNotation"/>
153+
<module name="ForbidWildcardAsReturnType"/>
154+
<module name="CustomDeclarationOrder">
155+
<property name="customDeclarationOrder"
156+
value="InnerEnum(public .*)
157+
### Field(public static final)
158+
### Field(public static .*)
159+
### Field(protected static final)
160+
### Field(protected static .*)
161+
### Field(static final)
162+
### Field(static .*)
163+
### Field(private static final)
164+
### Field(private static .*)
165+
### DeclareAnonClassField(public static final)
166+
### DeclareAnonClassField((private|protected) static final)
167+
### Field(@Autowired.* public)
168+
### Field(@Inject.* public)
169+
### Field(public.*)
170+
### Field(public)
171+
### Field(private final)
172+
### Field(private.*)
173+
### Field(private)
174+
### Field(.*)
175+
### Ctor(public)
176+
### Ctor(private)
177+
### MainMethod(.*)
178+
### Method((public|protected)?(\w*\s)?abstract\s)
179+
### Method(public static .*(new|edit|create|open|clone).*)
180+
### Method(@Autowired.* public)
181+
### Method(@Inject.* public)
182+
### Method(.*)
183+
### InnerEnum(private .*)
184+
### InnerInterface(.*)
185+
### InnerClass(.*)"/>
186+
</module>
187+
<module name="LogicConditionNeedOptimizationCheck"/>
188+
<module name="AvoidConditionInversionCheck"/>
189+
<module name="SingleBreakOrContinueCheck"/>
190+
<module name="NumericLiteralNeedsUnderscoreCheck"/>
191+
<module name="UniformEnumConstantNameCheck" />
192+
<module name="ForbidAnnotationElementValueCheck" />
193+
<module name="com.github.sevntu.checkstyle.checks.design.HideUtilityClassConstructorCheck"/>
194+
<module name="AvoidModifiersForTypesCheck">
195+
<property name="forbiddenClassesRegexpProtected" value="Logger"/>
196+
<property name="forbiddenClassesRegexpPublic" value="Logger"/>
197+
<property name="forbiddenClassesRegexpPackagePrivate" value="Logger"/>
198+
<property name="forbiddenClassesRegexpStatic" value="Logger"/>
199+
</module>
200+
<module name="ConstructorWithoutParamsCheck">
201+
<property name="classNameFormat" value=".*Exception$"/>
202+
<property name="ignoredClassNameFormat" value="UnsupportedOperationException"/>
203+
</module>
204+
<module name="ReturnCountExtendedCheck">
205+
<property name="maxReturnCount" value="1"/>
206+
<property name="topLinesToIgnoreCount" value="5"/>
207+
<property name="ignoreMethodLinesCount" value="0"/>
208+
<property name="ignoreEmptyReturns" value="false"/>
209+
</module>
210+
<module name="MoveVariableInsideIfCheck" />
211+
<module name="RequireFailForTryCatchInJunit" />
212+
<!-- we are not ready to activate this Check, too much violations
213+
and it requires bunch of refactoring -->
214+
<module name="com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck">
215+
<property name="severity" value="ignore"/>
216+
<property name="packages" value="com.puppycrawl.tools.checkstyle"/>
217+
<property name="excludePackages" value="com.puppycrawl.tools.checkstyle.gui"/>
218+
<property name="allowOverridingReturnValue" value="false"/>
219+
<property name="allowOverridingParameter" value="false"/>
220+
</module>
221+
<module name="CheckstyleTestMakeupCheck" />
222+
<module name="com.github.sevntu.checkstyle.checks.coding.ForbidCertainMethodCheck">
223+
<property name="methodName" value="assert(True|False)"/>
224+
<property name="argumentCount" value="1"/>
225+
</module>
226+
</module>
227+
</module>

config/import-control-test.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE import-control PUBLIC
3+
"-//Puppy Crawl//DTD Import Control 1.3//EN"
4+
"http://checkstyle.sourceforge.net/dtds/import_control_1_3.dtd">
5+
6+
<import-control pkg="" regex="true">
7+
</import-control>

config/import-control.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE import-control PUBLIC
3+
"-//Puppy Crawl//DTD Import Control 1.2//EN"
4+
"http://checkstyle.sourceforge.net/dtds/import_control_1_2.dtd">
5+
6+
<import-control pkg="" regex="true">
7+
</import-control>

config/java.header

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//============================================================================
2+
//
3+
// Copyright (C) 2002-2016 David Schneider, Lars Ködderitzsch
4+
//
5+
// This library is free software; you can redistribute it and/or
6+
// modify it under the terms of the GNU Lesser General Public
7+
// License as published by the Free Software Foundation; either
8+
// version 2.1 of the License, or (at your option) any later version.
9+
//
10+
// This library is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
// Lesser General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU Lesser General Public
16+
// License along with this library; if not, write to the Free Software
17+
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+
//
19+
//============================================================================

config/java_regexp.header

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
^/{2}={76}$
2+
^/{2}$
3+
^/{2} Copyright \(C\) \d\d\d\d-\d\d\d\d David Schneider, Lars Ködderitzsch$
4+
^/{2}$
5+
^/{2} This library is free software; you can redistribute it and/or$
6+
^/{2} modify it under the terms of the GNU Lesser General Public$
7+
^/{2} License as published by the Free Software Foundation; either$
8+
^/{2} version \d.\d of the License, or \(at your option\) any later version.$
9+
^/{2}$
10+
^/{2} This library is distributed in the hope that it will be useful,$
11+
^/{2} but WITHOUT ANY WARRANTY; without even the implied warranty of$
12+
^/{2} MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU$
13+
^/{2} Lesser General Public License for more details.$
14+
^/{2}$
15+
^/{2} You should have received a copy of the GNU Lesser General Public$
16+
^/{2} License along with this library; if not, write to the Free Software$
17+
^/{2} Foundation, Inc., \d\d Temple Place, Suite \d\d\d, Boston, MA \d\d\d\d\d-\d\d\d\d USA$
18+
^/{2}$
19+
^/{2}={76}$

0 commit comments

Comments
 (0)