Skip to content

Commit fc2e96e

Browse files
build: add Checkstyle reporter for unused imports and trailing whitespace (#1203)
build: add checkstyle reporter
1 parent ceb924f commit fc2e96e

8 files changed

Lines changed: 54 additions & 6 deletions

File tree

‎client/transport/spi/src/main/java/org/a2aproject/sdk/client/transport/spi/interceptors/auth/AuthInterceptor.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.a2aproject.sdk.client.transport.spi.interceptors.auth;
22

33
import java.util.HashMap;
4-
import java.util.List;
54
import java.util.Locale;
65
import java.util.Map;
76
import java.util.Set;

‎http-client/src/test/java/org/a2aproject/sdk/client/http/JdkA2AHttpClientTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.a2aproject.sdk.client.http;
22

33
import org.junit.jupiter.api.AfterEach;
4-
import org.junit.jupiter.api.BeforeEach;
54
import org.junit.jupiter.api.Test;
65
import org.mockserver.integration.ClientAndServer;
76

‎jsonrpc-common/src/test/java/org/a2aproject/sdk/jsonrpc/common/json/TaskSerializationTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import static org.junit.jupiter.api.Assertions.assertNull;
88
import static org.junit.jupiter.api.Assertions.assertTrue;
99

10-
import java.io.IOException;
1110
import java.nio.file.Files;
1211
import java.nio.file.Path;
1312
import java.time.OffsetDateTime;

‎pom.xml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
4949
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
5050
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
51+
<maven-checkstyle-plugin.version>3.5.0</maven-checkstyle-plugin.version>
52+
<checkstyle.failOnViolation>false</checkstyle.failOnViolation>
53+
<checkstyle.version>9.3</checkstyle.version>
5154
<gmavenplus-plugin.version>5.1.0</gmavenplus-plugin.version>
5255
<sonatype-central-publishing-plugin.version>0.11.0</sonatype-central-publishing-plugin.version>
5356
<groovy.version>5.1.2</groovy.version>
@@ -591,6 +594,36 @@
591594
<groupId>org.sonatype.central</groupId>
592595
<artifactId>central-publishing-maven-plugin</artifactId>
593596
</plugin>
597+
<plugin>
598+
<groupId>org.apache.maven.plugins</groupId>
599+
<artifactId>maven-checkstyle-plugin</artifactId>
600+
<version>${maven-checkstyle-plugin.version}</version>
601+
<dependencies>
602+
<dependency>
603+
<groupId>com.puppycrawl.tools</groupId>
604+
<artifactId>checkstyle</artifactId>
605+
<version>${checkstyle.version}</version>
606+
</dependency>
607+
</dependencies>
608+
<executions>
609+
<execution>
610+
<id>checkstyle-validation</id>
611+
<phase>validate</phase>
612+
<inherited>true</inherited>
613+
<configuration>
614+
<skip>false</skip>
615+
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
616+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
617+
<consoleOutput>true</consoleOutput>
618+
<failsOnError>false</failsOnError>
619+
<failOnViolation>${checkstyle.failOnViolation}</failOnViolation>
620+
</configuration>
621+
<goals>
622+
<goal>check</goal>
623+
</goals>
624+
</execution>
625+
</executions>
626+
</plugin>
594627
</plugins>
595628
</build>
596629

‎spec-grpc/src/main/java/org/a2aproject/sdk/grpc/mapper/AuthorizationCodeOAuthFlowMapper.java‎

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

33
import org.mapstruct.CollectionMappingStrategy;
44
import org.mapstruct.Mapper;
5-
import org.mapstruct.Mapping;
65

76
/**
87
* Mapper between {@link org.a2aproject.sdk.spec.AuthorizationCodeOAuthFlow} and {@link org.a2aproject.sdk.grpc.AuthorizationCodeOAuthFlow}.

‎spec-grpc/src/test/java/org/a2aproject/sdk/grpc/utils/JSONRPCUtilsTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.a2aproject.sdk.jsonrpc.common.wrappers.ListTasksRequest;
4242
import org.a2aproject.sdk.jsonrpc.common.wrappers.SendMessageRequest;
4343
import org.a2aproject.sdk.spec.DataPart;
44-
import org.a2aproject.sdk.spec.GetExtendedAgentCardParams;
4544
import org.a2aproject.sdk.spec.InvalidParamsError;
4645
import org.a2aproject.sdk.spec.JSONParseError;
4746
import org.a2aproject.sdk.spec.Message;

‎spec/src/main/java/org/a2aproject/sdk/spec/ListTasksParams.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.a2aproject.sdk.spec;
22

3-
import org.a2aproject.sdk.util.Assert;
43
import java.time.Instant;
54

65
import org.a2aproject.sdk.spec.util.Utils;

‎src/checkstyle/checkstyle.xml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
<module name="Checker">
7+
8+
<module name="TreeWalker">
9+
10+
<!-- Report trailing whitespace. -->
11+
<module name="RegexpSinglelineJava">
12+
<property name="format" value="[ \t]+$"/>
13+
<property name="message" value="Line has trailing whitespace."/>
14+
</module>
15+
16+
<!-- Report imports that are not used. -->
17+
<module name="UnusedImports"/>
18+
19+
</module>
20+
21+
</module>

0 commit comments

Comments
 (0)