Skip to content

Commit 331f3d6

Browse files
committed
Use checkstyle in the build
1 parent 3ec1701 commit 331f3d6

File tree

3 files changed

+146
-3
lines changed

3 files changed

+146
-3
lines changed

buildSrc/src/main/groovy/web-apis.java-conventions.gradle

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'java-library'
33
id 'maven-publish'
4+
id 'checkstyle'
45
}
56

67
group = 'io.sf.carte'
@@ -10,7 +11,7 @@ repositories {
1011
url = uri('https://repo.maven.apache.org/maven2/')
1112
}
1213
maven {
13-
url "https://css4j.github.io/maven/"
14+
url = "https://css4j.github.io/maven/"
1415
mavenContent {
1516
releasesOnly()
1617
}
@@ -116,6 +117,10 @@ tasks.withType(AbstractArchiveTask).configureEach {
116117
}
117118
}
118119

120+
checkstyle {
121+
toolVersion = "10.21.2"
122+
}
123+
119124
publishing {
120125
publications {
121126
maven(MavenPublication) {

config/checkstyle/checkstyle.xml

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
3+
<module name="Checker">
4+
<property name="severity" value="warning"/>
5+
<property name="tabWidth" value="4"/>
6+
<property name="fileExtensions" value="java"/>
7+
8+
<module name="BeforeExecutionExclusionFileFilter">
9+
<property name="fileNamePattern" value="module\-info\.java$"/>
10+
</module>
11+
12+
<module name="LineLength">
13+
<!--
14+
Recommended line length is up to 120 characters, but only 130 are enforced.
15+
In the end, readability is more important than arbitrary limits; if you
16+
believe that some file should be allowed more, please use the suppressions
17+
configuration file (under the 'Line length' comment).
18+
-->
19+
<property name="max" value="130"/>
20+
<property name="ignorePattern" value="^\t(?:public |protected |private )?static final"/>
21+
</module>
22+
23+
<!-- Files must end with a line separator -->
24+
<module name="NewlineAtEndOfFile"/>
25+
26+
<!-- Look for trailing whitespace except in single-line comments,
27+
yet allow one if it comes after an asterisk or a javadoc @throws
28+
(the latter is commonly found in tests) -->
29+
<module name="RegexpSingleline">
30+
<property name="format" value="^[^/](?! \* @throws [a-zA-Z]+).*(?:[^*]\s+|\*\s{2,})$"/>
31+
<property name="message" value="Line has trailing spaces."/>
32+
</module>
33+
34+
<module name="TreeWalker">
35+
36+
<module name="OuterTypeFilename"/>
37+
38+
<!-- Enforce the use of tabs for indentation in Java files -->
39+
<module name="RegexpSinglelineJava">
40+
<property name="format" value="^\t* "/>
41+
<property name="message" value="Indent must use tab characters"/>
42+
<property name="ignoreComments" value="true"/>
43+
</module>
44+
45+
<!-- Use Java-style array declarations -->
46+
<module name="ArrayTypeStyle"/>
47+
48+
<module name="AvoidStarImport">
49+
<property name="severity" value="error"/>
50+
</module>
51+
52+
<!-- Detect standalone ";" semicolon -->
53+
<module name="EmptyStatement"/>
54+
55+
<!-- Checks the whitespace around "<" and ">" -->
56+
<module name="GenericWhitespace"/>
57+
58+
<module name="LeftCurly"/>
59+
60+
<!-- Verify that method names conform to a specified pattern -->
61+
<module name="MethodName">
62+
<property name="format" value="^_?[a-z](_?[a-zA-Z0-9]+)*$"/>
63+
</module>
64+
65+
<module name="MethodParamPad"/>
66+
67+
<!-- The order of modifiers conforms to the suggestions in the
68+
JLS § 8.1.1, 8.3.1, 8.4.3 and 9.4 -->
69+
<module name="ModifierOrder"/>
70+
71+
<!-- Checks that there is no whitespace after a token -->
72+
<module name="NoWhitespaceAfter">
73+
<property name="allowLineBreaks" value="false"/>
74+
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
75+
</module>
76+
77+
<!-- Checks that there is no whitespace before a token -->
78+
<module name="NoWhitespaceBefore"/>
79+
80+
<module name="OneStatementPerLine"/>
81+
82+
<!-- Checks that package names conform to a pattern -->
83+
<module name="PackageName"/>
84+
85+
<module name="ParameterName">
86+
<!-- For readability, names starting with '_' are not allowed -->
87+
<property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/>
88+
</module>
89+
90+
<!-- Verify the padding of parentheses -->
91+
<module name="ParenPad"/>
92+
93+
<!-- Look for redundant imports -->
94+
<module name="RedundantImport"/>
95+
96+
<!-- Checks for redundant modifiers (e.g. 'public' in interface methods) -->
97+
<module name="RedundantModifier">
98+
<property name="tokens" value="INTERFACE_DEF,ENUM_DEF"/>
99+
</module>
100+
101+
<!-- Checks for over-complicated boolean expressions -->
102+
<module name="SimplifyBooleanExpression"/>
103+
104+
<module name="SimplifyBooleanReturn"/>
105+
106+
<module name="SingleSpaceSeparator"/>
107+
108+
<!-- Checks that static, non-final variable names conform to a pattern -->
109+
<!-- <module name="StaticVariableName"/> -->
110+
111+
<module name="SuppressionCommentFilter">
112+
<property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/>
113+
<property name="onCommentFormat" value="CSON\: ([\w\|]+)"/>
114+
<property name="checkFormat" value="$1"/>
115+
</module>
116+
117+
<!-- parentheses for typecasts -->
118+
<module name="TypecastParenPad">
119+
<property name="tokens" value="RPAREN,TYPECAST"/>
120+
</module>
121+
122+
<module name="TypeName">
123+
<property name="format" value="^[A-Z](_?[a-zA-Z0-9]+)*$"/>
124+
</module>
125+
126+
<module name="UnusedImports">
127+
<property name="processJavadoc" value="true"/>
128+
</module>
129+
130+
<!-- Checks that long constants are defined with an 'L' -->
131+
<module name="UpperEll"/>
132+
133+
</module>
134+
135+
</module>

svgom-api/src/main/java/org/w3c/dom/svg/SVGFEImageElement.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
package org.w3c.dom.svg;
1414

15-
public interface SVGFEImageElement extends SVGElement, SVGURIReference, SVGLangSpace, SVGExternalResourcesRequired, SVGFilterPrimitiveStandardAttributes {
16-
SVGAnimatedPreserveAspectRatio getPreserveAspectRatio();
15+
public interface SVGFEImageElement extends SVGElement, SVGURIReference, SVGLangSpace,
16+
SVGExternalResourcesRequired, SVGFilterPrimitiveStandardAttributes {
17+
18+
SVGAnimatedPreserveAspectRatio getPreserveAspectRatio();
19+
1720
}

0 commit comments

Comments
 (0)