Skip to content

Commit 42ac8f3

Browse files
committed
#33 Adding CheckStyle configuration
1 parent 5db95bf commit 42ac8f3

7 files changed

Lines changed: 277 additions & 0 deletions

File tree

build-config/pom.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright 2012-2013 Gunnar Morling (http://www.gunnarmorling.de/)
5+
and/or other contributors as indicated by the @authors tag. See the
6+
copyright.txt file in the distribution for a full listing of all
7+
contributors.
8+
9+
Licensed under the Apache License, Version 2.0 (the "License");
10+
you may not use this file except in compliance with the License.
11+
You may obtain a copy of the License at
12+
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
15+
Unless required by applicable law or agreed to in writing, software
16+
distributed under the License is distributed on an "AS IS" BASIS,
17+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
See the License for the specific language governing permissions and
19+
limitations under the License.
20+
21+
-->
22+
<project xmlns="http://maven.apache.org/POM/4.0.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<parent>
28+
<groupId>org.mapstruct</groupId>
29+
<artifactId>mapstruct-parent</artifactId>
30+
<version>0.1.0-SNAPSHOT</version>
31+
<relativePath>../parent/pom.xml</relativePath>
32+
</parent>
33+
34+
<artifactId>mapstruct-build-config</artifactId>
35+
<packaging>jar</packaging>
36+
<name>MapStruct Build Configuration</name>
37+
</project>
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
5+
6+
<!-- Based on sun_checks.xml from the CheckStyle distribution -->
7+
8+
<module name="Checker">
9+
<!--
10+
If you set the basedir property below, then all reported file
11+
names will be relative to the specified directory. See
12+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
13+
14+
<property name="basedir" value="${basedir}"/>
15+
-->
16+
17+
<!-- Checks that each Java package has a Javadoc file used for commenting. -->
18+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
19+
<!--
20+
<module name="JavadocPackage">
21+
<property name="allowLegacy" value="true"/>
22+
</module>
23+
-->
24+
25+
<!-- Checks whether files end with a new line. -->
26+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
27+
<module name="NewlineAtEndOfFile"/>
28+
29+
<!-- Checks that property files contain the same keys. -->
30+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
31+
<module name="Translation"/>
32+
33+
<module name="FileLength"/>
34+
35+
<!-- Following interprets the header file as regular expressions. -->
36+
<!-- <module name="RegexpHeader"/> -->
37+
38+
<module name="FileTabCharacter">
39+
<property name="eachLine" value="true"/>
40+
</module>
41+
42+
<module name="RegexpSingleline">
43+
<!-- \s matches whitespace character, $ matches end of line. -->
44+
<property name="format" value="\s+$"/>
45+
<property name="message" value="Line has trailing spaces."/>
46+
</module>
47+
48+
<module name="TreeWalker">
49+
50+
<property name="cacheFile" value="${checkstyle.cache.file}"/>
51+
52+
<!-- Checks for Javadoc comments. -->
53+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
54+
<!-- <module name="JavadocMethod"/> -->
55+
<!-- <module name="JavadocType"/> -->
56+
<!-- <module name="JavadocVariable"/> -->
57+
<!-- <module name="JavadocStyle"/> -->
58+
59+
60+
<!-- Checks for Naming Conventions. -->
61+
<!-- See http://checkstyle.sf.net/config_naming.html -->
62+
<module name="ConstantName"/>
63+
<module name="LocalFinalVariableName"/>
64+
<module name="LocalVariableName"/>
65+
<module name="MemberName"/>
66+
<module name="MethodName"/>
67+
<module name="PackageName"/>
68+
<module name="ParameterName"/>
69+
<module name="StaticVariableName"/>
70+
<module name="TypeName"/>
71+
72+
73+
<!-- Checks for Headers -->
74+
<!-- See http://checkstyle.sf.net/config_header.html -->
75+
<!-- <module name="Header"> -->
76+
<!-- The follow property value demonstrates the ability -->
77+
<!-- to have access to ANT properties. In this case it uses -->
78+
<!-- the ${basedir} property to allow Checkstyle to be run -->
79+
<!-- from any directory within a project. See property -->
80+
<!-- expansion, -->
81+
<!-- http://checkstyle.sf.net/config.html#properties -->
82+
<!-- <property -->
83+
<!-- name="headerFile" -->
84+
<!-- value="${basedir}/java.header"/> -->
85+
<!-- </module> -->
86+
87+
88+
<!-- Checks for imports -->
89+
<!-- See http://checkstyle.sf.net/config_import.html -->
90+
<module name="AvoidStarImport"/>
91+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
92+
<module name="RedundantImport"/>
93+
<module name="UnusedImports"/>
94+
95+
96+
<!-- Checks for Size Violations. -->
97+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
98+
<module name="LineLength">
99+
<property name="max" value="120"/>
100+
</module>
101+
<module name="MethodLength"/>
102+
<module name="ParameterNumber">
103+
<property name="max" value="10"/>
104+
</module>
105+
106+
107+
<!-- Checks for whitespace -->
108+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
109+
<module name="EmptyForIteratorPad"/>
110+
<module name="MethodParamPad"/>
111+
<module name="NoWhitespaceAfter">
112+
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
113+
</module>
114+
<module name="NoWhitespaceBefore"/>
115+
<!-- <module name="OperatorWrap"/> -->
116+
<module name="ParenPad">
117+
<property name="tokens" value="CTOR_CALL, METHOD_CALL, SUPER_CTOR_CALL"/>
118+
<property name="option" value="space"/>
119+
</module>
120+
<module name="TypecastParenPad"/>
121+
<module name="WhitespaceAfter"/>
122+
<module name="WhitespaceAround"/>
123+
124+
125+
<!-- Modifier Checks -->
126+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
127+
<module name="ModifierOrder"/>
128+
<module name="RedundantModifier"/>
129+
130+
131+
<!-- Checks for blocks. You know, those {}'s -->
132+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
133+
<module name="AvoidNestedBlocks"/>
134+
<module name="EmptyBlock"/>
135+
<module name="LeftCurly"/>
136+
<module name="NeedBraces"/>
137+
<module name="RightCurly">
138+
<property name="option" value="alone"/>
139+
</module>
140+
141+
142+
<!-- Checks for common coding problems -->
143+
<!-- See http://checkstyle.sf.net/config_coding.html -->
144+
<!-- <module name="AvoidInlineConditionals"/> -->
145+
<module name="EmptyStatement"/>
146+
<module name="EqualsHashCode"/>
147+
<!-- <module name="HiddenField"/> -->
148+
<module name="IllegalInstantiation"/>
149+
<module name="InnerAssignment"/>
150+
<!-- <module name="MagicNumber"/> -->
151+
<module name="MissingSwitchDefault"/>
152+
<module name="RedundantThrows"/>
153+
<module name="SimplifyBooleanExpression"/>
154+
<module name="SimplifyBooleanReturn"/>
155+
156+
157+
<!-- Checks for class design -->
158+
<!-- See http://checkstyle.sf.net/config_design.html -->
159+
<!-- <module name="DesignForExtension"/> -->
160+
<!-- <module name="FinalClass"/> -->
161+
<module name="HideUtilityClassConstructor"/>
162+
<module name="InterfaceIsType"/>
163+
<module name="VisibilityModifier"/>
164+
165+
166+
<!-- Miscellaneous other checks. -->
167+
<!-- See http://checkstyle.sf.net/config_misc.html -->
168+
<module name="ArrayTypeStyle"/>
169+
<!-- <module name="FinalParameters"/> -->
170+
<!-- <module name="TodoComment"/> -->
171+
<module name="UpperEll"/>
172+
173+
</module>
174+
175+
</module>

core/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,22 @@
4747
<scope>test</scope>
4848
</dependency>
4949
</dependencies>
50+
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-checkstyle-plugin</artifactId>
56+
<executions>
57+
<execution>
58+
<id>check-style</id>
59+
<phase>verify</phase>
60+
<goals>
61+
<goal>checkstyle</goal>
62+
</goals>
63+
</execution>
64+
</executions>
65+
</plugin>
66+
</plugins>
67+
</build>
5068
</project>

integrationtest/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@
9292
<skip>true</skip>
9393
</configuration>
9494
</plugin>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-checkstyle-plugin</artifactId>
98+
<executions>
99+
<execution>
100+
<id>check-style</id>
101+
<phase>verify</phase>
102+
<goals>
103+
<goal>checkstyle</goal>
104+
</goals>
105+
</execution>
106+
</executions>
107+
</plugin>
95108
</plugins>
96109
</build>
97110
</project>

parent/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,25 @@
139139
<artifactId>maven-assembly-plugin</artifactId>
140140
<version>2.4</version>
141141
</plugin>
142+
<plugin>
143+
<groupId>org.apache.maven.plugins</groupId>
144+
<artifactId>maven-checkstyle-plugin</artifactId>
145+
<version>2.10</version>
146+
<configuration>
147+
<configLocation>build-config/checkstyle.xml</configLocation>
148+
<consoleOutput>true</consoleOutput>
149+
<failsOnError>true</failsOnError>
150+
<violationSeverity>error</violationSeverity>
151+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
152+
</configuration>
153+
<dependencies>
154+
<dependency>
155+
<groupId>${project.groupId}</groupId>
156+
<artifactId>mapstruct-build-config</artifactId>
157+
<version>${project.version}</version>
158+
</dependency>
159+
</dependencies>
160+
</plugin>
142161
<plugin>
143162
<groupId>org.apache.maven.plugins</groupId>
144163
<artifactId>maven-clean-plugin</artifactId>
@@ -276,6 +295,7 @@
276295
<strictCheck>true</strictCheck>
277296
<excludes>
278297
<exclude>.idea/**</exclude>
298+
<exclude>**/checkstyle.xml</exclude>
279299
<exclude>copyright.txt</exclude>
280300
<exclude>**/license.txt</exclude>
281301
<exclude>**/mapstruct.xml</exclude>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
<modules>
4040
<module>parent</module>
41+
<module>build-config</module>
4142
<module>core</module>
4243
<module>processor</module>
4344
<module>integrationtest</module>

processor/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@
136136
</execution>
137137
</executions>
138138
</plugin>
139+
<plugin>
140+
<groupId>org.apache.maven.plugins</groupId>
141+
<artifactId>maven-checkstyle-plugin</artifactId>
142+
<executions>
143+
<execution>
144+
<id>check-style</id>
145+
<phase>verify</phase>
146+
<goals>
147+
<goal>checkstyle</goal>
148+
</goals>
149+
</execution>
150+
</executions>
151+
</plugin>
139152
</plugins>
140153
</build>
141154

0 commit comments

Comments
 (0)