Skip to content

Commit 4910c35

Browse files
committed
Merge branch 'release/0.30'
2 parents 86eafba + 8f34ffa commit 4910c35

File tree

150 files changed

+2018
-956
lines changed

Some content is hidden

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

150 files changed

+2018
-956
lines changed

build.gradle

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ buildscript {
88
}
99
dependencies {
1010
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2"
11+
classpath "com.diffplug.gradle.spotless:spotless:1.3.3"
12+
classpath "de.thetaphi:forbiddenapis:2.2"
13+
classpath "de.aaschmid:gradle-cpd-plugin:1.0"
1114
}
1215
}
1316

@@ -36,6 +39,154 @@ subprojects {
3639

3740
sourceCompatibility = 1.8
3841
targetCompatibility = 1.8
42+
43+
// ======== code quality ========
44+
apply plugin: "checkstyle"
45+
apply plugin: "findbugs"
46+
apply plugin: "pmd"
47+
apply plugin: "cpd"
48+
apply plugin: "jacoco"
49+
apply plugin: "de.thetaphi.forbiddenapis"
50+
apply plugin: "com.diffplug.gradle.spotless"
51+
52+
// compiler
53+
compileJava {
54+
options.compilerArgs << "-Xlint"
55+
}
56+
57+
// jacoco
58+
jacocoTestReport {
59+
reports {
60+
xml.enabled false
61+
csv.enabled false
62+
}
63+
}
64+
65+
// checkstyle
66+
checkstyle {
67+
toolVersion = "7.1.2"
68+
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
69+
}
70+
checkstyleTest {
71+
configFile = rootProject.file("config/checkstyle/checkstyle-test.xml")
72+
}
73+
74+
// workaround: see https://issues.gradle.org/browse/GRADLE-2888
75+
task verifyNoCheckstyleWarningsInMain {
76+
group = "verification"
77+
description = "Fail if checkstyleMain result contains warnings"
78+
doLast {
79+
File warningsFile = file('build/reports/checkstyle/main.xml')
80+
if (warningsFile.exists() && warningsFile.text.contains("<error ")) {
81+
throw new GradleException("There were checkstyle warnings! For more info check $warningsFile")
82+
}
83+
}
84+
}
85+
checkstyleMain.finalizedBy verifyNoCheckstyleWarningsInMain
86+
task verifyNoCheckstyleWarningsInTest {
87+
group = "verification"
88+
description = "Fail if checkstyleTest result contains warnings"
89+
doLast {
90+
File warningsFile = file('build/reports/checkstyle/test.xml')
91+
if (warningsFile.exists() && warningsFile.text.contains("<error ")) {
92+
throw new GradleException("There were checkstyle warnings! For more info check $warningsFile")
93+
}
94+
}
95+
}
96+
checkstyleTest.finalizedBy verifyNoCheckstyleWarningsInTest
97+
98+
// findbugs
99+
findbugs {
100+
effort = "max"
101+
includeFilter = file("../config/findbugs/includeFilter.xml")
102+
excludeFilter = file("../config/findbugs/excludeFilter.xml")
103+
}
104+
tasks.withType(FindBugs) {
105+
reports {
106+
xml.enabled = false
107+
html.enabled = true
108+
}
109+
}
110+
111+
// pmd
112+
pmd {
113+
consoleOutput = true
114+
}
115+
pmdMain {
116+
ruleSetFiles = files("../config/pmd/pmd-settings.xml")
117+
ruleSets = [] // To apply only the custom rules
118+
}
119+
pmdTest {
120+
ruleSetFiles = files("../config/pmd/pmd-settings-test.xml")
121+
ruleSets = [] // To apply only the custom rules
122+
}
123+
cpdCheck {
124+
reports {
125+
text.enabled = true
126+
xml.enabled = false
127+
}
128+
source = sourceSets.main.allJava // only main source
129+
ignoreFailures = true
130+
}
131+
132+
// forbiddenapis
133+
forbiddenApisMain {
134+
bundledSignatures += [
135+
'jdk-system-out',
136+
'jdk-unsafe-' + project.sourceCompatibility,
137+
'jdk-internal-' + project.sourceCompatibility
138+
]
139+
signaturesFiles = fileTree(dir: "../config/forbiddenapis", include: "*.txt")
140+
ignoreFailures = false
141+
}
142+
forbiddenApisTest {
143+
bundledSignatures += [
144+
'jdk-system-out',
145+
'jdk-internal-' + project.sourceCompatibility
146+
]
147+
ignoreFailures = false
148+
}
149+
150+
// spotless
151+
spotless {
152+
java {
153+
licenseHeaderFile '../config/spotless/spotless.license.java'
154+
importOrderFile '../config/spotless/spotless.importorder'
155+
eclipseFormatFile '../config/spotless/spotless.eclipseformat.xml'
156+
157+
// Eclipse formatter screws up long literals with underscores inside of annotations (see issue #14)
158+
// @Max(value = 9_999_999 L) // what Eclipse does
159+
// @Max(value = 9_999_999L) // what I wish Eclipse did
160+
custom 'Long literal fix', { it.replaceAll('([0-9_]+) [Ll]', '$1L') }
161+
162+
// Eclipse formatter puts excess whitespace after lambda blocks
163+
// funcThatTakesLambdas(x -> {} , y -> {} ) // what Eclipse does
164+
// funcThatTakesLambdas(x -> {}, y -> {}) // what I wish Eclipse did
165+
custom 'Lambda fix', { it.replace('} )', '})').replace('} ,', '},') }
166+
167+
indentWithTabs()
168+
endWithNewline()
169+
170+
customReplaceRegex 'Add space before comment asterisk', '^(\\t*)\\*', '$1 *'
171+
// customReplaceRegex 'Remove indent before line comment', '^\\t*//', '//'
172+
}
173+
174+
// this will create two tasks: spotlessMiscCheck and spotlessMiscApply
175+
format 'misc', {
176+
// target determines which files this format will apply to
177+
// - if you pass a string or a list of strings, they will be treated
178+
// as 'include' parameters to a fileTree in the root directory
179+
// - if you pass a FileCollection, it will pass through untouched
180+
// e.g. project.files('build.gradle', 'settings.gradle')
181+
// - if you pass anything else, it will be sent to project.files(yourArg)
182+
target '**/*.gradle', '**/*.md', '**/.gitignore'
183+
184+
// spotless has built-in rules for the most basic formatting tasks
185+
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
186+
endWithNewline()
187+
}
188+
}
189+
39190

40191
// ======== create source and javadoc bundles ========
41192
task sourcesJar(type: Jar, dependsOn: classes) {

circle.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ checkout:
22
post:
33
- chmod +x ./gradlew
44

5-
dependencies:
5+
dependencies:
66
override:
77
- ./gradlew -v
88
- ./gradlew testClasses
99

10+
general:
11+
artifacts:
12+
- "build/reports"
13+
1014
machine:
1115
environment:
12-
GRADLE_OPTS: -Xmx4G -Dorg.gradle.daemon=true
16+
_JAVA_OPTIONS: -Xmx3G
17+
GRADLE_OPTS: -Dorg.gradle.daemon=true
18+
TERM: dumb
1319
java:
1420
version: oraclejdk8
1521
post:
@@ -18,4 +24,4 @@ machine:
1824

1925
test:
2026
override:
21-
- ./gradlew --full-stacktrace check
27+
- ./gradlew check jacocoTestReport
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
<module name="Checker">
4+
<property name="severity" value="warning"/>
5+
<module name="TreeWalker">
6+
<module name="FileContentsHolder"/>
7+
<module name="JavadocMethod">
8+
<property name="severity" value="ignore"/>
9+
<property name="allowUndeclaredRTE" value="true"/>
10+
<property name="allowMissingParamTags" value="true"/>
11+
<property name="allowMissingThrowsTags" value="true"/>
12+
<property name="allowMissingReturnTag" value="true"/>
13+
<property name="logLoadErrors" value="true"/>
14+
<property name="suppressLoadErrors" value="true"/>
15+
</module>
16+
<module name="JavadocType">
17+
<property name="severity" value="ignore"/>
18+
</module>
19+
<module name="JavadocVariable">
20+
<property name="severity" value="ignore"/>
21+
</module>
22+
<module name="JavadocStyle">
23+
<property name="severity" value="ignore"/>
24+
<property name="checkEmptyJavadoc" value="true"/>
25+
<property name="checkFirstSentence" value="false"/>
26+
</module>
27+
<module name="ConstantName"/>
28+
<module name="LocalFinalVariableName"/>
29+
<module name="LocalVariableName"/>
30+
<module name="MemberName"/>
31+
<!--
32+
<module name="MethodName"/>
33+
-->
34+
<module name="PackageName"/>
35+
<module name="ParameterName"/>
36+
<module name="StaticVariableName"/>
37+
<module name="TypeName"/>
38+
<module name="AvoidStarImport"/>
39+
<module name="RedundantImport"/>
40+
<module name="LineLength">
41+
<property name="max" value="128"/>
42+
<property name="tabWidth" value="4"/>
43+
</module>
44+
<!-- テストではメソッド長を制限しない
45+
<module name="MethodLength">
46+
<property name="max" value="100"/>
47+
</module>
48+
-->
49+
<module name="ParameterNumber">
50+
<property name="max" value="20"/>
51+
</module>
52+
<module name="EmptyForIteratorPad"/>
53+
<module name="MethodParamPad"/>
54+
<module name="NoWhitespaceAfter"/>
55+
<module name="NoWhitespaceBefore"/>
56+
<module name="OperatorWrap">
57+
<property name="tokens" value="BAND,BOR,BSR,BXOR,COLON,DIV,EQUAL,GE,GT,LAND,LE,LITERAL_INSTANCEOF,LOR,LT,MINUS,MOD,NOT_EQUAL,PLUS,SL,SR,STAR"/>
58+
</module>
59+
<module name="TabCharacter">
60+
<property name="severity" value="ignore"/>
61+
</module>
62+
<module name="WhitespaceAfter"/>
63+
<module name="WhitespaceAround">
64+
<property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT"/>
65+
</module>
66+
<module name="ModifierOrder"/>
67+
<module name="RedundantModifier"/>
68+
<module name="EmptyBlock">
69+
<property name="option" value="text"/>
70+
</module>
71+
<module name="LeftCurly"/>
72+
<module name="NeedBraces"/>
73+
<module name="RightCurly"/>
74+
<module name="EmptyStatement"/>
75+
<module name="EqualsHashCode"/>
76+
<module name="HiddenField">
77+
<property name="severity" value="info"/>
78+
<property name="tokens" value="VARIABLE_DEF"/>
79+
<property name="ignoreConstructorParameter" value="true"/>
80+
<property name="ignoreSetter" value="true"/>
81+
<property name="ignoreAbstractMethods" value="true"/>
82+
</module>
83+
<module name="IllegalInstantiation">
84+
<property name="severity" value="ignore"/>
85+
</module>
86+
<!--
87+
<module name="MagicNumber">
88+
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20"/>
89+
</module>
90+
-->
91+
<module name="MissingSwitchDefault"/>
92+
<module name="SimplifyBooleanExpression">
93+
<property name="severity" value="ignore"/>
94+
</module>
95+
<module name="SimplifyBooleanReturn"/>
96+
<module name="DesignForExtension">
97+
<property name="severity" value="ignore"/>
98+
</module>
99+
<module name="FinalClass">
100+
<property name="severity" value="ignore"/>
101+
<metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="info"/>
102+
</module>
103+
<module name="InterfaceIsType">
104+
<property name="severity" value="ignore"/>
105+
</module>
106+
<module name="VisibilityModifier">
107+
<property name="severity" value="ignore"/>
108+
</module>
109+
<module name="ArrayTypeStyle"/>
110+
<module name="FinalParameters">
111+
<property name="severity" value="ignore"/>
112+
</module>
113+
<module name="GenericIllegalRegexp">
114+
<property name="severity" value="ignore"/>
115+
</module>
116+
<module name="TodoComment">
117+
<property name="severity" value="ignore"/>
118+
</module>
119+
<module name="UpperEll"/>
120+
<module name="ParenPad">
121+
<property name="tokens" value="CTOR_CALL,SUPER_CTOR_CALL"/>
122+
</module>
123+
<module name="TypecastParenPad">
124+
<property name="tokens" value="RPAREN,TYPECAST"/>
125+
</module>
126+
<module name="CovariantEquals"/>
127+
<module name="DeclarationOrder">
128+
<property name="severity" value="ignore"/>
129+
</module>
130+
<module name="ExplicitInitialization">
131+
<property name="severity" value="ignore"/>
132+
</module>
133+
<module name="FallThrough">
134+
<property name="severity" value="ignore"/>
135+
</module>
136+
<module name="FinalLocalVariable">
137+
<property name="severity" value="ignore"/>
138+
</module>
139+
<module name="MissingCtor">
140+
<property name="severity" value="ignore"/>
141+
</module>
142+
<module name="ModifiedControlVariable">
143+
<property name="severity" value="ignore"/>
144+
</module>
145+
<!--
146+
<module name="MultipleStringLiterals">
147+
<property name="allowedDuplicates" value="10"/>
148+
<property name="ignoreStringsRegexp" value='^(("")|(", ")|("deprecation")|("javadoc")|("rawtypes")|("serial")|("unckecked")|("unused")|("ja_JP"))$'/>
149+
</module>
150+
-->
151+
<module name="MultipleVariableDeclarations">
152+
<property name="severity" value="info"/>
153+
</module>
154+
<module name="NestedIfDepth">
155+
<property name="max" value="3"/>
156+
</module>
157+
<module name="NestedTryDepth">
158+
<property name="max" value="2"/>
159+
</module>
160+
<module name="PackageDeclaration"/>
161+
<module name="ReturnCount">
162+
<property name="max" value="8"/>
163+
</module>
164+
<module name="StringLiteralEquality"/>
165+
<module name="SuperClone"/>
166+
<module name="SuperFinalize"/>
167+
<module name="UnnecessaryParentheses"/>
168+
<module name="AvoidInlineConditionals">
169+
<property name="severity" value="ignore"/>
170+
</module>
171+
<module name="DefaultComesLast"/>
172+
<module name="TrailingComment">
173+
<property name="severity" value="ignore"/>
174+
</module>
175+
</module>
176+
<module name="SuppressionCommentFilter"/>
177+
<module name="SuppressWithNearbyCommentFilter">
178+
<property name="checkFormat" value=".*"/>
179+
<property name="influenceFormat" value="0"/>
180+
</module>
181+
<module name="FileLength"/>
182+
<module name="NewlineAtEndOfFile"/>
183+
<module name="Translation"/>
184+
</module>

0 commit comments

Comments
 (0)