Skip to content

Commit e4b08a0

Browse files
Turned on checkstyle
1 parent 94e9b8f commit e4b08a0

File tree

268 files changed

+4986
-3865
lines changed

Some content is hidden

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

268 files changed

+4986
-3865
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = tab
8+
indent_size = 4
9+
end_of_line = lf
10+
insert_final_newline = true
11+
12+
[*.yml]
13+
indent_style = space
14+
indent_size = 2

.mvn/settings.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<settings>
3-
<servers>
4-
<server>
5-
<id>sonatype-nexus-staging</id>
6-
<username>${env.sonatype_username}</username>
7-
<password>${env.sonatype_password}</password>
8-
</server>
9-
<server>
10-
<id>repo.spring.io</id>
11-
<username>${env.spring_username}</username>
12-
<password>${env.spring_password}</password>
13-
</server>
14-
</servers>
3+
<servers>
4+
<server>
5+
<id>sonatype-nexus-staging</id>
6+
<username>${env.sonatype_username}</username>
7+
<password>${env.sonatype_password}</password>
8+
</server>
9+
<server>
10+
<id>repo.spring.io</id>
11+
<username>${env.spring_username}</username>
12+
<password>${env.spring_password}</password>
13+
</server>
14+
</servers>
1515
</settings>

.springformat

Whitespace-only changes.

docs/pom.xml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66
<artifactId>spring-cloud-function-docs</artifactId>
@@ -66,24 +66,33 @@
6666
<target>
6767
<java classname="org.jruby.Main"
6868
failonerror="yes">
69-
<arg value="${docs.resources.dir}/ruby/generate_readme.sh"/>
69+
<arg
70+
value="${docs.resources.dir}/ruby/generate_readme.sh"/>
7071
<arg value="-o"/>
71-
<arg value="${adapters.path}/spring-cloud-function-adapter-aws/README.adoc"/>
72-
<arg value="${basedir}/src/main/asciidoc/adapters/aws-readme.adoc"/>
72+
<arg
73+
value="${adapters.path}/spring-cloud-function-adapter-aws/README.adoc"/>
74+
<arg
75+
value="${basedir}/src/main/asciidoc/adapters/aws-readme.adoc"/>
7376
</java>
7477
<java classname="org.jruby.Main"
7578
failonerror="yes">
76-
<arg value="${docs.resources.dir}/ruby/generate_readme.sh"/>
79+
<arg
80+
value="${docs.resources.dir}/ruby/generate_readme.sh"/>
7781
<arg value="-o"/>
78-
<arg value="${adapters.path}/spring-cloud-function-adapter-azure/README.adoc"/>
79-
<arg value="${basedir}/src/main/asciidoc/adapters/azure-readme.adoc"/>
82+
<arg
83+
value="${adapters.path}/spring-cloud-function-adapter-azure/README.adoc"/>
84+
<arg
85+
value="${basedir}/src/main/asciidoc/adapters/azure-readme.adoc"/>
8086
</java>
8187
<java classname="org.jruby.Main"
8288
failonerror="yes">
83-
<arg value="${docs.resources.dir}/ruby/generate_readme.sh"/>
89+
<arg
90+
value="${docs.resources.dir}/ruby/generate_readme.sh"/>
8491
<arg value="-o"/>
85-
<arg value="${adapters.path}/spring-cloud-function-adapter-openwhisk/README.adoc"/>
86-
<arg value="${basedir}/src/main/asciidoc/adapters/openwhisk-readme.adoc"/>
92+
<arg
93+
value="${adapters.path}/spring-cloud-function-adapter-openwhisk/README.adoc"/>
94+
<arg
95+
value="${basedir}/src/main/asciidoc/adapters/openwhisk-readme.adoc"/>
8796
</java>
8897
</target>
8998
</configuration>

pipeline.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,75 @@
22
# fly --target cloud set-pipeline --config pipeline.yml --pipeline spring-cloud-function --load-vars-from credentials.yml
33
---
44
jobs:
5-
- name: build
6-
plan:
7-
- get: source
8-
trigger: true
9-
- task: maven
10-
config:
11-
platform: linux
12-
image_resource:
13-
type: docker-image
14-
source:
15-
repository: springio/maven-base
16-
inputs:
17-
- name: source
18-
caches:
19-
- path: source/.m2
20-
run:
21-
dir: source
22-
path: sh
23-
args:
24-
- -c
25-
- |
26-
rm -rf ~/.m2
27-
ln -s $(pwd)/.m2 ~/.m2
28-
./mvnw deploy -s .mvn/settings.xml -Dgpg.passphrase="${passphrase}"
29-
params:
30-
TERM: -dumb
31-
passphrase: {{passphrase}}
32-
sonatype_username: {{sonatype-username}}
33-
sonatype_password: {{sonatype-password}}
34-
spring_username: {{spring-username}}
35-
spring_password: {{spring-password}}
36-
on_failure: *slack-failure
37-
on_success: *slack-success
5+
- name: build
6+
plan:
7+
- get: source
8+
trigger: true
9+
- task: maven
10+
config:
11+
platform: linux
12+
image_resource:
13+
type: docker-image
14+
source:
15+
repository: springio/maven-base
16+
inputs:
17+
- name: source
18+
caches:
19+
- path: source/.m2
20+
run:
21+
dir: source
22+
path: sh
23+
args:
24+
- -c
25+
- |
26+
rm -rf ~/.m2
27+
ln -s $(pwd)/.m2 ~/.m2
28+
./mvnw deploy -s .mvn/settings.xml -Dgpg.passphrase="${passphrase}"
29+
params:
30+
TERM: -dumb
31+
passphrase: {{passphrase}}
32+
sonatype_username: {{sonatype-username}}
33+
sonatype_password: {{sonatype-password}}
34+
spring_username: {{spring-username}}
35+
spring_password: {{spring-password}}
36+
on_failure: *slack-failure
37+
on_success: *slack-success
3838

3939
slack-failure: &slack-failure
4040
put: slack
4141
params:
4242
channel: spring-cloud-firehose
4343
attachments:
44-
- color: danger
45-
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
46-
text: "Build has failed"
47-
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
48-
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
44+
- color: danger
45+
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
46+
text: "Build has failed"
47+
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
48+
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
4949

5050
slack-success: &slack-success
5151
put: slack
5252
params:
5353
channel: spring-cloud-firehose
5454
attachments:
55-
- color: good
56-
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
57-
text: "Build has succeeded"
58-
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
59-
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
55+
- color: good
56+
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
57+
text: "Build has succeeded"
58+
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
59+
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
6060

6161
resources:
62-
- name: source
63-
type: git
64-
source:
65-
uri: https://github.com/spring-cloud/spring-cloud-function.git
66-
- name: slack
67-
type: slack-notification
68-
source:
69-
url: {{slack-url}}
70-
62+
- name: source
63+
type: git
64+
source:
65+
uri: https://github.com/spring-cloud/spring-cloud-function.git
66+
- name: slack
67+
type: slack-notification
68+
source:
69+
url: {{slack-url}}
70+
7171
resource_types:
72-
- name: slack-notification
73-
type: docker-image
74-
source:
75-
repository: nebhale/slack-notification-resource
72+
- name: slack-notification
73+
type: docker-image
74+
source:
75+
repository: nebhale/slack-notification-resource
7676

pom.xml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

77
<artifactId>spring-cloud-function-parent</artifactId>
@@ -13,7 +13,7 @@
1313
<groupId>org.springframework.cloud</groupId>
1414
<artifactId>spring-cloud-build</artifactId>
1515
<version>2.1.3.BUILD-SNAPSHOT</version>
16-
<relativePath />
16+
<relativePath/>
1717
</parent>
1818

1919
<properties>
@@ -23,6 +23,9 @@
2323
<spring-cloud-task.version>2.1.0.RELEASE</spring-cloud-task.version>
2424
<wrapper.version>1.0.15.RELEASE</wrapper.version>
2525
<docs.main>spring-cloud-function</docs.main>
26+
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
27+
<maven-checkstyle-plugin.failsOnViolation>true
28+
</maven-checkstyle-plugin.failsOnViolation>
2629
</properties>
2730

2831
<dependencyManagement>
@@ -91,6 +94,14 @@
9194
</execution>
9295
</executions>
9396
</plugin>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-checkstyle-plugin</artifactId>
100+
</plugin>
101+
<plugin>
102+
<groupId>io.spring.javaformat</groupId>
103+
<artifactId>spring-javaformat-maven-plugin</artifactId>
104+
</plugin>
94105
</plugins>
95106
<pluginManagement>
96107
<plugins>
@@ -99,7 +110,8 @@
99110
<inherited>false</inherited>
100111
<configuration>
101112
<aggregate>true</aggregate>
102-
<excludePackageNames>com.example,functions,example</excludePackageNames>
113+
<excludePackageNames>com.example,functions,example
114+
</excludePackageNames>
103115
</configuration>
104116
<executions>
105117
<execution>
@@ -216,6 +228,15 @@
216228
</pluginRepository>
217229
</pluginRepositories>
218230

231+
<reporting>
232+
<plugins>
233+
<plugin>
234+
<groupId>org.apache.maven.plugins</groupId>
235+
<artifactId>maven-checkstyle-plugin</artifactId>
236+
</plugin>
237+
</plugins>
238+
</reporting>
239+
219240
<profiles>
220241
<profile>
221242
<id>java11+</id>

spring-cloud-function-adapters/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56

67
<artifactId>spring-cloud-function-adapter-parent</artifactId>
@@ -18,6 +19,6 @@
1819
<module>spring-cloud-function-adapter-aws</module>
1920
<module>spring-cloud-function-adapter-openwhisk</module>
2021
<module>spring-cloud-function-adapter-azure</module>
21-
</modules>
22+
</modules>
2223

2324
</project>

spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56

67
<artifactId>spring-cloud-function-adapter-aws</artifactId>

spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/SpringBootApiGatewayRequestHandler.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
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.
@@ -32,7 +32,6 @@
3232
import org.springframework.messaging.support.GenericMessage;
3333

3434
/**
35-
*
3635
* @author Dave Syer
3736
* @author Oleg Zhurakousky
3837
*
@@ -66,12 +65,12 @@ protected Object convertEvent(APIGatewayProxyRequestEvent event) {
6665
}
6766

6867
private boolean functionAcceptsMessage() {
69-
return inspector.isMessage(function());
68+
return this.inspector.isMessage(function());
7069
}
7170

7271
private Object deserializeBody(String json) {
7372
try {
74-
return mapper.readValue(json, getInputType());
73+
return this.mapper.readValue(json, getInputType());
7574
}
7675
catch (Exception e) {
7776
throw new IllegalStateException("Cannot convert event", e);
@@ -91,13 +90,15 @@ private MessageHeaders getHeaders(APIGatewayProxyRequestEvent event) {
9190
protected APIGatewayProxyResponseEvent convertOutput(Object output) {
9291
if (functionReturnsMessage(output)) {
9392
Message<?> message = (Message<?>) output;
94-
return new APIGatewayProxyResponseEvent().withStatusCode(
95-
(Integer) message.getHeaders().getOrDefault("statuscode", HttpStatus.OK.value()))
93+
return new APIGatewayProxyResponseEvent()
94+
.withStatusCode((Integer) message.getHeaders()
95+
.getOrDefault("statuscode", HttpStatus.OK.value()))
9696
.withHeaders(toResponseHeaders(message.getHeaders()))
9797
.withBody(serializeBody(message.getPayload()));
9898
}
9999
else {
100-
return new APIGatewayProxyResponseEvent().withStatusCode(HttpStatus.OK.value())
100+
return new APIGatewayProxyResponseEvent()
101+
.withStatusCode(HttpStatus.OK.value())
101102
.withBody(serializeBody(output));
102103

103104
}
@@ -116,7 +117,7 @@ private Map<String, String> toResponseHeaders(MessageHeaders messageHeaders) {
116117

117118
private String serializeBody(Object body) {
118119
try {
119-
return mapper.writeValueAsString(body);
120+
return this.mapper.writeValueAsString(body);
120121
}
121122
catch (JsonProcessingException e) {
122123
throw new IllegalStateException("Cannot convert output", e);

0 commit comments

Comments
 (0)