Skip to content

Commit 15f8ddb

Browse files
authored
Checkstyle Update (#87)
* Updated .gitignore for intellij * Removed properties from pom.xml. * Cleaned up pom and added comments. * Cleaned up original checkstyle config. * Added in Header check. * Added header checks. * Enabled checksytle toggle via comment. * Fixed license header in sample apps.
1 parent 9882115 commit 15f8ddb

File tree

6 files changed

+306
-286
lines changed

6 files changed

+306
-286
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ service-account.json
33
### Java ###
44
*.class
55

6+
# intellij
7+
.idea/
8+
*.iml
9+
610
# Mobile Tools for Java (J2ME)
711
.mtj.tmp/
812

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
^/\*$
2+
^<!--$
3+
^\W+\*?\W*Copyright 20\d\d Google Inc.$
4+
^\W+\*?\W*$
5+
^\W+\*?\W*Licensed under the Apache License, Version 2.0 \(the "License"\);$
6+
^\W+\*?\W*you may not use this file except in compliance with the License.$
7+
^\W+\*?\W*You may obtain a copy of the License at$
8+
^\W+\*?\W*$
9+
^\W+\*?\W*http://www.apache.org/licenses/LICENSE-2.0$
10+
^\W+\*?\W*$
11+
^\W+\*?\W*Unless required by applicable law or agreed to in writing, software$
12+
^\W+\*?\W*distributed under the License is distributed on an "AS IS" BASIS,$
13+
^\W+\*?\W*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.$
14+
^\W+\*?\W*See the License for the specific language governing permissions and$
15+
^\W+\*?\W*limitations under the License.$
16+
^\W\*/$
17+
^-->$

pom.xml

Lines changed: 41 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ limitations under the License.
2222
<packaging>pom</packaging>
2323

2424
<name>${project.groupId}:${project.artifactId}</name>
25-
<description>A shared configuration for Google Cloud samples. This defines
25+
<description>
26+
A shared configuration for Google Cloud samples. This defines
2627
common plugins and their configurations for testing, maintenance, and style
27-
checks.</description>
28+
checks.
29+
</description>
2830
<url>https://github.com/GoogleCloudPlatform/java-repo-tools</url>
2931

3032
<licenses>
@@ -76,42 +78,18 @@ limitations under the License.
7678
<properties>
7779
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
7880
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
79-
80-
<jacoco-maven-plugin>0.7.9</jacoco-maven-plugin>
81-
<plexus-compiler-javac-errorprone>2.8.2</plexus-compiler-javac-errorprone>
82-
<error_prone_core>2.0.21</error_prone_core>
83-
84-
<maven-failsafe-plugin>2.20</maven-failsafe-plugin>
85-
<maven-surefire-plugin>2.20</maven-surefire-plugin>
86-
<maven-checkstyle-plugin>2.17</maven-checkstyle-plugin>
87-
<maven-clean-plugin>3.0.0</maven-clean-plugin>
88-
<maven-deploy-plugin>2.8.2</maven-deploy-plugin>
89-
<maven-install-plugin>2.5.2</maven-install-plugin>
90-
<maven-site-plugin>3.6</maven-site-plugin>
91-
<maven-compiler-plugin>3.6.2</maven-compiler-plugin>
92-
<maven-resources-plugin>3.0.2</maven-resources-plugin>
93-
<maven-war-plugin>3.0.0</maven-war-plugin>
94-
<maven-assembly-plugin>3.0.0</maven-assembly-plugin>
95-
<maven-jar-plugin>3.0.2</maven-jar-plugin>
96-
<maven-source-plugin>3.0.1</maven-source-plugin>
97-
<maven-archetype-plugin>3.0.1</maven-archetype-plugin>
98-
99-
<maven-release-plugin>2.5.3</maven-release-plugin>
100-
<nexus-staging-maven-plugin>1.6.8</nexus-staging-maven-plugin>
101-
<versions-maven-plugin>2.4</versions-maven-plugin>
102-
<maven-gpg-plugin>1.6</maven-gpg-plugin>
10381
</properties>
10482

10583
<profiles>
106-
<!-- Code signing for release: http://stackoverflow.com/a/14869692/101923 -->
107-
<profile>
84+
<profile> <!-- Code signing for release: http://stackoverflow.com/a/14869692/101923 -->
10885
<id>release</id>
10986
<build>
11087
<plugins>
88+
11189
<plugin>
11290
<groupId>org.apache.maven.plugins</groupId>
11391
<artifactId>maven-source-plugin</artifactId>
114-
<version>${maven-source-plugin}</version>
92+
<version>3.0.1</version>
11593
<executions>
11694
<execution>
11795
<id>attach-sources</id>
@@ -124,13 +102,13 @@ limitations under the License.
124102

125103
<plugin>
126104
<artifactId>maven-archetype-plugin</artifactId>
127-
<version>${maven-archetype-plugin}</version>
105+
<version>3.0.1</version>
128106
</plugin>
129107

130108
<plugin>
131109
<groupId>org.apache.maven.plugins</groupId>
132110
<artifactId>maven-gpg-plugin</artifactId>
133-
<version>${maven-gpg-plugin}</version>
111+
<version>1.6</version>
134112
<executions>
135113
<execution>
136114
<id>sign-artifacts</id>
@@ -145,18 +123,19 @@ limitations under the License.
145123
</execution>
146124
</executions>
147125
</plugin>
126+
148127
</plugins>
149128
</build>
150129
</profile>
151130
</profiles>
152131

153132
<build>
154133
<plugins>
155-
<!-- Compiler -->
156-
<plugin>
134+
135+
<plugin> <!-- Compile w/ Errorprone -->
157136
<groupId>org.apache.maven.plugins</groupId>
158137
<artifactId>maven-compiler-plugin</artifactId>
159-
<version>${maven-compiler-plugin}</version>
138+
<version>3.6.2</version>
160139
<configuration>
161140
<compilerId>javac-with-errorprone</compilerId>
162141
<forceJavacCompilerUse>true</forceJavacCompilerUse>
@@ -165,32 +144,31 @@ limitations under the License.
165144
<dependency>
166145
<groupId>org.codehaus.plexus</groupId>
167146
<artifactId>plexus-compiler-javac-errorprone</artifactId>
168-
<version>${plexus-compiler-javac-errorprone}</version>
147+
<version>2.8.2</version>
169148
</dependency>
170149
<!-- override plexus-compiler-javac-errorprone's dependency on
171150
Error Prone with the latest version -->
172151
<dependency>
173152
<groupId>com.google.errorprone</groupId>
174153
<artifactId>error_prone_core</artifactId>
175-
<version>${error_prone_core}</version>
154+
<version>2.0.21</version>
176155
</dependency>
177156
</dependencies>
178157
</plugin>
179158

180-
<!-- Unit tests -->
181-
<plugin>
159+
<plugin> <!-- Unit Tests -->
182160
<groupId>org.apache.maven.plugins</groupId>
183161
<artifactId>maven-surefire-plugin</artifactId>
184-
<version>${maven-surefire-plugin}</version>
162+
<version>2.20</version>
185163
<configuration>
186164
<trimStackTrace>false</trimStackTrace>
187165
</configuration>
188166
</plugin>
189-
<plugin>
190-
<!-- Integration / system tests -->
167+
168+
<plugin> <!-- Integration / System Tests -->
191169
<groupId>org.apache.maven.plugins</groupId>
192170
<artifactId>maven-failsafe-plugin</artifactId>
193-
<version>${maven-failsafe-plugin}</version>
171+
<version>2.20</version>
194172
<executions>
195173
<execution>
196174
<goals>
@@ -200,47 +178,54 @@ limitations under the License.
200178
</execution>
201179
</executions>
202180
</plugin>
203-
<plugin>
181+
182+
<plugin> <!-- Style Check -->
204183
<groupId>org.apache.maven.plugins</groupId>
205184
<artifactId>maven-checkstyle-plugin</artifactId>
206-
<version>${maven-checkstyle-plugin}</version>
185+
<version>2.17</version>
207186
<configuration>
208187
<configLocation>google-checks.xml</configLocation>
188+
<headerLocation>LICENSE.txt</headerLocation>
189+
<suppressionsLocation>suppressions.xml</suppressionsLocation>
190+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
209191
<consoleOutput>true</consoleOutput>
192+
<logViolationsToConsole>true</logViolationsToConsole>
210193
<failOnViolation>true</failOnViolation>
211-
<includeTestSourceDirectory>true</includeTestSourceDirectory>
212-
<suppressionsLocation>suppressions.xml</suppressionsLocation>
213194
</configuration>
214195
<dependencies>
215196
<!-- Add a dependency to use bundled resources.
216197
See: http://stackoverflow.com/a/19690484/101923 -->
217-
218198
<dependency>
219199
<groupId>com.google.cloud.samples</groupId>
220200
<artifactId>checkstyle-configuration</artifactId>
221201
<version>1.0.3-SNAPSHOT</version>
222202
</dependency>
223-
224203
<dependency>
225204
<groupId>com.puppycrawl.tools</groupId>
226205
<artifactId>checkstyle</artifactId>
227206
<version>8.1</version>
228207
</dependency>
229-
230208
</dependencies>
231209
<executions>
232-
<execution><goals><goal>check</goal></goals></execution>
210+
<execution>
211+
<phase>verify</phase>
212+
<goals>
213+
<goal>check</goal>
214+
</goals>
215+
</execution>
233216
</executions>
234217
</plugin>
235-
<plugin>
218+
219+
<plugin> <!-- Used for managing and upgrading dependencies -->
236220
<groupId>org.codehaus.mojo</groupId>
237221
<artifactId>versions-maven-plugin</artifactId>
238-
<version>${versions-maven-plugin}</version>
222+
<version>2.4</version>
239223
</plugin>
240-
<plugin>
224+
225+
<plugin> <!-- Used for creating basic report creation -->
241226
<groupId>org.jacoco</groupId>
242227
<artifactId>jacoco-maven-plugin</artifactId>
243-
<version>${jacoco-maven-plugin}</version>
228+
<version>0.7.9</version>
244229
<executions>
245230
<execution>
246231
<goals>
@@ -256,6 +241,8 @@ limitations under the License.
256241
</execution>
257242
</executions>
258243
</plugin>
244+
259245
</plugins>
260246
</build>
247+
261248
</project>

test/src/main/java/com/google/cloud/samples/test/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 Google Inc. All Rights Reserved.
2+
* Copyright 2016 Google Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

test/src/test/java/com/google/cloud/samples/test/AppTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 Google Inc. All Rights Reserved.
2+
* Copyright 2016 Google Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)