Skip to content

Commit 2be41c2

Browse files
committed
WS-2609: Add Checkstyle and PMD. Finish rewriting tests. Address Checkstyle, PMD and Sonar issues.
1 parent f84a068 commit 2be41c2

File tree

60 files changed

+435
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+435
-218
lines changed

annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 Basis Technology Corp.
2+
* Copyright 2017 Basis Technology Corp.
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.

annotations/src/main/java/com/basistech/rosette/annotations/JacksonMixinProcessor.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
2+
* Copyright 2022 Basis Technology Corp.
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.
@@ -48,6 +48,7 @@
4848
public class JacksonMixinProcessor extends AbstractProcessor {
4949

5050
private static final String PACKAGE_NAME = "com.basistech.rosette.apimodel.jackson";
51+
private static final String VALUE = "value";
5152

5253
private ProcessingEnvironment processingEnvironment;
5354

@@ -58,6 +59,7 @@ public synchronized void init(ProcessingEnvironment processingEnvironment) {
5859
}
5960

6061
@Override
62+
@SuppressWarnings("java:S3516") // From the Javadoc: "A processor may always return the same boolean value..."
6163
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment) {
6264
if (roundEnvironment.getElementsAnnotatedWith(JacksonMixin.class).isEmpty()) {
6365
return true;
@@ -76,14 +78,14 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
7678
.classBuilder(typeElement.getSimpleName().toString() + "Mixin")
7779
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
7880
.addAnnotation(AnnotationSpec.builder(JsonTypeName.class)
79-
.addMember("value", "$S", typeElement.getSimpleName())
81+
.addMember(VALUE, "$S", typeElement.getSimpleName())
8082
.build())
8183
.addAnnotation(AnnotationSpec.builder(JsonDeserialize.class)
8284
.addMember("builder", CodeBlock.builder()
8385
.add(elementQualifiedName + "." + elementSimpleName + "Builder.class").build())
8486
.build())
8587
.addAnnotation(AnnotationSpec.builder(JsonInclude.class)
86-
.addMember("value", CodeBlock.builder()
88+
.addMember(VALUE, CodeBlock.builder()
8789
.add("JsonInclude.Include.NON_NULL").build())
8890
.build())
8991
.addType(TypeSpec
@@ -119,7 +121,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
119121
.classBuilder("MixinUtil")
120122
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
121123
.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class)
122-
.addMember("value", "$S", "PMD")
124+
.addMember(VALUE, "$S", "PMD")
123125
.build())
124126
.addMethod(methodSpecBuilder.build());
125127
try {

api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 Basis Technology Corp.
2+
* Copyright 2022 Basis Technology Corp.
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.
@@ -177,6 +177,7 @@ private static byte[] getBytes(InputStream is) throws IOException {
177177
}
178178
}
179179

180+
@SuppressWarnings("java:HttpClient_must_be_closed") // This library requires keeping the connection open.
180181
private void initClient(String key, List<Header> additionalHeaders) {
181182
HttpClientBuilder builder = HttpClients.custom();
182183
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();

api/src/test/java/com/basistech/rosette/api/BasicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 Basis Technology Corp.
2+
* Copyright 2022 Basis Technology Corp.
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.

api/src/test/java/com/basistech/rosette/api/DevRosetteAPITest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 Basis Technology Corp.
2+
* Copyright 2022 Basis Technology Corp.
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.

api/src/test/java/com/basistech/rosette/api/InvalidErrorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 Basis Technology Corp.
2+
* Copyright 2022 Basis Technology Corp.
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)