Skip to content

Commit e87a379

Browse files
shreyashtpivovarit
authored andcommitted
BAEL-1226 Checkstyle introduction. (eugenp#3736)
* BAEL-1226:- Changes for checkstyle * BAEL-1226: Changes for checkstyle * Changes for BAEL-1226:- Chnaged the file to match in article. * Formatting chnages. * BAEL-1226: Change for the pom
1 parent 86a0333 commit e87a379

4 files changed

Lines changed: 54 additions & 5 deletions

File tree

‎spring-rest/checkstyle.xml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="TreeWalker">
7+
<module name="AvoidStarImport">
8+
<property name="severity" value="warning" />
9+
</module>
10+
</module>
11+
</module>

‎spring-rest/pom.xml‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@
219219
</configuration>
220220
</configuration>
221221
</plugin>
222+
223+
<plugin>
224+
<groupId>org.apache.maven.plugins</groupId>
225+
<artifactId>maven-checkstyle-plugin</artifactId>
226+
<version>${checkstyle-maven-plugin.version}</version>
227+
<configuration>
228+
<configLocation>checkstyle.xml</configLocation>
229+
</configuration>
230+
<executions>
231+
<execution>
232+
<goals>
233+
<goal>check</goal>
234+
</goals>
235+
</execution>
236+
</executions>
237+
</plugin>
222238

223239
</plugins>
224240

@@ -311,6 +327,19 @@
311327

312328
</profiles>
313329

330+
<reporting>
331+
<plugins>
332+
<plugin>
333+
<groupId>org.apache.maven.plugins</groupId>
334+
<artifactId>maven-checkstyle-plugin</artifactId>
335+
<version>${checkstyle-maven-plugin.version}</version>
336+
<configuration>
337+
<configLocation>checkstyle.xml</configLocation>
338+
</configuration>
339+
</plugin>
340+
</plugins>
341+
</reporting>
342+
314343
<properties>
315344
<commons-fileupload.version>1.3.2</commons-fileupload.version>
316345
<kryo.version>4.0.0</kryo.version>
@@ -325,7 +354,8 @@
325354
<!-- Maven plugins -->
326355
<cargo-maven2-plugin.version>1.6.0</cargo-maven2-plugin.version>
327356
<findbugs-maven-plugin.version>3.0.4</findbugs-maven-plugin.version>
328-
357+
<checkstyle-maven-plugin.version>3.0.0</checkstyle-maven-plugin.version>
358+
<dependency.locations.enabled>false</dependency.locations.enabled>
329359
<!-- okhttp -->
330360
<com.squareup.okhttp3.version>3.4.1</com.squareup.okhttp3.version>
331361

‎spring-rest/src/main/java/org/baeldung/web/controller/HeavyResourceController.java‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package org.baeldung.web.controller;
22

33

4+
import java.util.Map;
5+
46
import org.baeldung.repository.HeavyResourceRepository;
57
import org.baeldung.web.dto.HeavyResource;
68
import org.baeldung.web.dto.HeavyResourceAddressOnly;
79
import org.springframework.http.MediaType;
810
import org.springframework.http.ResponseEntity;
9-
import org.springframework.web.bind.annotation.*;
10-
11-
import java.util.Map;
11+
import org.springframework.web.bind.annotation.PathVariable;
12+
import org.springframework.web.bind.annotation.RequestBody;
13+
import org.springframework.web.bind.annotation.RequestMapping;
14+
import org.springframework.web.bind.annotation.RequestMethod;
15+
import org.springframework.web.bind.annotation.RestController;
1216

1317
@RestController
1418
public class HeavyResourceController {

‎spring-rest/src/main/java/org/baeldung/web/controller/mediatypes/CustomMediaTypeController.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
import org.baeldung.web.dto.BaeldungItem;
44
import org.baeldung.web.dto.BaeldungItemV2;
5-
import org.springframework.web.bind.annotation.*;
5+
import org.springframework.web.bind.annotation.PathVariable;
6+
import org.springframework.web.bind.annotation.RequestMapping;
7+
import org.springframework.web.bind.annotation.RequestMethod;
8+
import org.springframework.web.bind.annotation.ResponseBody;
9+
import org.springframework.web.bind.annotation.RestController;
610

711
@RestController
812
@RequestMapping(value = "/", produces = "application/vnd.baeldung.api.v1+json")

0 commit comments

Comments
 (0)