Skip to content

Commit 8978f7e

Browse files
committed
Enable checkstyle on main sources
Closes gh-1479
2 parents 34583e2 + 17c4dd4 commit 8978f7e

File tree

524 files changed

+5138
-4892
lines changed

Some content is hidden

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

524 files changed

+5138
-4892
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2005-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.ws.gradle.conventions;
18+
19+
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
20+
import org.gradle.api.Plugin;
21+
import org.gradle.api.Project;
22+
import org.gradle.api.artifacts.DependencySet;
23+
import org.gradle.api.plugins.JavaPlugin;
24+
import org.gradle.api.plugins.quality.Checkstyle;
25+
import org.gradle.api.plugins.quality.CheckstyleExtension;
26+
import org.gradle.api.plugins.quality.CheckstylePlugin;
27+
28+
/**
29+
* {@link Plugin} that applies conventions for checkstyle.
30+
*
31+
* @author Brian Clozel
32+
* @author Stephane Nicoll
33+
*/
34+
public class CheckstyleConventions {
35+
36+
/**
37+
* Applies the Spring Java Format and Checkstyle plugins with the project conventions.
38+
* @param project the current project
39+
*/
40+
public void apply(Project project) {
41+
project.getPlugins().withType(JavaPlugin.class, (java) -> {
42+
project.getPlugins().apply(CheckstylePlugin.class);
43+
project.getTasks().withType(Checkstyle.class).forEach(checkstyle -> checkstyle.getMaxHeapSize().set("1g"));
44+
project.getTasks().named("checkstyleTest").configure(task -> task.setEnabled(false));
45+
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
46+
checkstyle.setToolVersion("10.21.1");
47+
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
48+
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
49+
DependencySet checkstyleDependencies = project.getConfigurations()
50+
.getByName("checkstyle")
51+
.getDependencies();
52+
checkstyleDependencies.add(
53+
project.getDependencies().create("com.puppycrawl.tools:checkstyle:" + checkstyle.getToolVersion()));
54+
checkstyleDependencies
55+
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
56+
});
57+
}
58+
59+
}

gradle/plugins/conventions-plugin/src/main/java/org/springframework/ws/gradle/conventions/ConventionsPlugin.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ public class ConventionsPlugin implements Plugin<Project> {
3333
@Override
3434
public void apply(Project project) {
3535
project.setGroup("org.springframework.ws");
36-
project.getPlugins()
37-
.withType(JavaBasePlugin.class)
38-
.all((plugin) -> new JavaBasePluginConventions().apply(project));
36+
project.getPlugins().withType(JavaBasePlugin.class).all((plugin) -> {
37+
new JavaBasePluginConventions().apply(project);
38+
new CheckstyleConventions().apply(project);
39+
});
3940
project.getPlugins().withType(JavaPlugin.class).all((plugin) -> new JavaPluginConventions().apply(project));
4041
project.getPlugins()
4142
.withType(MavenPublishPlugin.class)

spring-ws-core/src/main/java/org/springframework/ws/FaultAwareWebServiceMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
* often require different processing rules.
2525
*
2626
* @author Arjen Poutsma
27-
* @see org.springframework.ws.soap.SoapMessage
2827
* @since 1.0.0
28+
* @see org.springframework.ws.soap.SoapMessage
2929
*/
3030
public interface FaultAwareWebServiceMessage extends WebServiceMessage {
3131

spring-ws-core/src/main/java/org/springframework/ws/WebServiceMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
* Contains methods that provide access to the payload of the message.
2929
*
3030
* @author Arjen Poutsma
31+
* @since 1.0.0
3132
* @see org.springframework.ws.soap.SoapMessage
3233
* @see WebServiceMessageFactory
33-
* @since 1.0.0
3434
*/
3535
public interface WebServiceMessage {
3636

spring-ws-core/src/main/java/org/springframework/ws/WebServiceMessageFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
* Allows the creation of empty messages, or messages based on {@code InputStream}s.
2727
*
2828
* @author Arjen Poutsma
29-
* @see org.springframework.ws.WebServiceMessage
3029
* @since 1.0.0
30+
* @see org.springframework.ws.WebServiceMessage
3131
*/
3232
public interface WebServiceMessageFactory {
3333

spring-ws-core/src/main/java/org/springframework/ws/client/WebServiceFaultException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class WebServiceFaultException extends WebServiceClientException {
3232
/** Create a new instance of the {@code WebServiceFaultException} class. */
3333
public WebServiceFaultException(String msg) {
3434
super(msg);
35-
faultMessage = null;
35+
this.faultMessage = null;
3636
}
3737

3838
/**
@@ -46,7 +46,7 @@ public WebServiceFaultException(FaultAwareWebServiceMessage faultMessage) {
4646

4747
/** Returns the fault message. */
4848
public FaultAwareWebServiceMessage getWebServiceMessage() {
49-
return faultMessage;
49+
return this.faultMessage;
5050
}
5151

5252
}

spring-ws-core/src/main/java/org/springframework/ws/client/core/SimpleFaultMessageResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
* fault occurs.
2626
*
2727
* @author Arjen Poutsma
28-
* @see WebServiceFaultException
2928
* @since 1.0.0
29+
* @see WebServiceFaultException
3030
*/
3131
public class SimpleFaultMessageResolver implements FaultMessageResolver {
3232

spring-ws-core/src/main/java/org/springframework/ws/client/core/SourceExtractor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@
3434
* Implementations of this interface perform the actual work of extracting results, but
3535
* don't need to worry about exception handling, or resource handling.
3636
*
37+
* @param <T> the type of the source
3738
* @author Arjen Poutsma
38-
* @see org.springframework.ws.client.core.WebServiceTemplate
3939
* @since 1.0.0
40+
* @see org.springframework.ws.client.core.WebServiceTemplate
4041
*/
4142
public interface SourceExtractor<T> {
4243

spring-ws-core/src/main/java/org/springframework/ws/client/core/WebServiceMessageExtractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* Implementations of this interface perform the actual work of extracting results, but
3636
* don't need to worry about exception handling, or resource handling.
3737
*
38+
* @param <T> the type of the result object
3839
* @author Arjen Poutsma
3940
* @since 1.0.0
4041
*/

spring-ws-core/src/main/java/org/springframework/ws/client/core/WebServiceOperations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
* testability, as it can easily be mocked or stubbed.
2929
*
3030
* @author Arjen Poutsma
31-
* @see WebServiceTemplate
3231
* @since 1.0.0
32+
* @see WebServiceTemplate
3333
*/
3434
public interface WebServiceOperations {
3535

0 commit comments

Comments
 (0)