Skip to content

Commit 97e5d3f

Browse files
authored
Reformat all java files (#1627)
Formatting was previously being handled by code_style–ij.xml which is not really compatible with many new IDEs. This PR changes formating to GoogleStyle enforced by the spotless gradle plugin in conjunction with jdtls, which is compatible with vscode and eclipse. Execute `gradle spotlessApply` to execute the formatter using gradle locally.
1 parent 51451e5 commit 97e5d3f

File tree

380 files changed

+12407
-18999
lines changed

Some content is hidden

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

380 files changed

+12407
-18999
lines changed

cuebot/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id('com.google.protobuf') version "0.9.1"
88
id('jacoco')
99
id('org.sonarqube') version "2.8"
10+
id('com.diffplug.spotless') version "5.16.0"
1011
}
1112

1213
sourceCompatibility = 11
@@ -172,3 +173,11 @@ test {
172173
}
173174
}
174175
}
176+
177+
spotless {
178+
java {
179+
targetExclude 'src/compiled_protobuf/**'
180+
toggleOffOn()
181+
eclipse().configFile('jdtls.xml')
182+
}
183+
}

cuebot/code_style_ij.xml

Lines changed: 0 additions & 67 deletions
This file was deleted.

cuebot/jdtls.xml

Lines changed: 337 additions & 0 deletions
Large diffs are not rendered by default.

cuebot/src/main/java/com/imageworks/common/spring/remoting/CueServerInterceptor.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@
77
import io.grpc.ServerCallHandler;
88
import io.grpc.ServerInterceptor;
99
import io.grpc.Status;
10-
import org.apache.logging.log4j.Logger;
1110
import org.apache.logging.log4j.LogManager;
12-
11+
import org.apache.logging.log4j.Logger;
1312

1413
public class CueServerInterceptor implements ServerInterceptor {
1514

1615
private static final Logger logger = LogManager.getLogger(CueServerInterceptor.class);
1716
private static final Logger accessLogger = LogManager.getLogger("API");
1817

1918
@Override
20-
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
21-
ServerCall<ReqT, RespT> serverCall, Metadata metadata,
22-
ServerCallHandler<ReqT, RespT> serverCallHandler) {
23-
accessLogger.info("gRPC [" +
24-
serverCall.getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR) +
25-
"]: " + serverCall.getMethodDescriptor().getFullMethodName());
19+
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> serverCall,
20+
Metadata metadata, ServerCallHandler<ReqT, RespT> serverCallHandler) {
21+
accessLogger.info("gRPC [" + serverCall.getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR)
22+
+ "]: " + serverCall.getMethodDescriptor().getFullMethodName());
2623

2724
ServerCall.Listener<ReqT> delegate = serverCallHandler.startCall(serverCall, metadata);
2825
return new SimpleForwardingServerCallListener<ReqT>(delegate) {
@@ -32,10 +29,8 @@ public void onHalfClose() {
3229
super.onHalfClose();
3330
} catch (Exception e) {
3431
logger.error("Caught an unexpected error.", e);
35-
serverCall.close(Status.INTERNAL
36-
.withCause(e)
37-
.withDescription(e.toString() + "\n" + e.getMessage()),
38-
new Metadata());
32+
serverCall.close(Status.INTERNAL.withCause(e)
33+
.withDescription(e.toString() + "\n" + e.getMessage()), new Metadata());
3934
}
4035
}
4136

cuebot/src/main/java/com/imageworks/common/spring/remoting/GrpcServer.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import com.imageworks.spcue.servant.ManageTask;
3939
import com.imageworks.spcue.servant.RqdReportStatic;
4040

41-
4241
public class GrpcServer implements ApplicationContextAware {
4342

4443
private static final Logger logger = LogManager.getLogger(GrpcServer.class);
@@ -72,8 +71,7 @@ public void shutdown() {
7271
}
7372

7473
public void start() throws IOException {
75-
server = ServerBuilder
76-
.forPort(this.port)
74+
server = ServerBuilder.forPort(this.port)
7775
.addService(applicationContext.getBean("rqdReportStatic", RqdReportStatic.class))
7876
.addService(applicationContext.getBean("cueStaticServant", CueStatic.class))
7977
.addService(applicationContext.getBean("manageAction", ManageAction.class))
@@ -93,14 +91,16 @@ public void start() throws IOException {
9391
.addService(applicationContext.getBean("manageMatcher", ManageMatcher.class))
9492
.addService(applicationContext.getBean("manageOwner", ManageOwner.class))
9593
.addService(applicationContext.getBean("manageProc", ManageProc.class))
96-
.addService(applicationContext.getBean("manageRenderPartition", ManageRenderPartition.class))
94+
.addService(applicationContext.getBean("manageRenderPartition",
95+
ManageRenderPartition.class))
9796
.addService(applicationContext.getBean("manageService", ManageService.class))
98-
.addService(applicationContext.getBean("manageServiceOverride", ManageServiceOverride.class))
97+
.addService(applicationContext.getBean("manageServiceOverride",
98+
ManageServiceOverride.class))
9999
.addService(applicationContext.getBean("manageShow", ManageShow.class))
100-
.addService(applicationContext.getBean("manageSubscription", ManageSubscription.class))
100+
.addService(
101+
applicationContext.getBean("manageSubscription", ManageSubscription.class))
101102
.addService(applicationContext.getBean("manageTask", ManageTask.class))
102-
.maxInboundMessageSize(maxMessageBytes)
103-
.intercept(new CueServerInterceptor())
103+
.maxInboundMessageSize(maxMessageBytes).intercept(new CueServerInterceptor())
104104
.build();
105105
server.start();
106106
logger.info("gRPC server started on " + this.name + " at port " + this.port + " !");

cuebot/src/main/java/com/imageworks/spcue/ActionEntity.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22
/*
33
* Copyright Contributors to the OpenCue Project
44
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
87
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
109
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License
11+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
* or implied. See the License for the specific language governing permissions and limitations under
13+
* the License.
1614
*/
1715

18-
19-
2016
package com.imageworks.spcue;
2117

2218
import com.imageworks.spcue.grpc.filter.Action;
@@ -85,7 +81,7 @@ public String getActionId() {
8581
}
8682

8783
public String getFilterId() {
88-
if (filterId == null){
84+
if (filterId == null) {
8985
throw new SpcueRuntimeException(
9086
"Trying to get a filterId from a ActityEntity created without a filter");
9187
}
@@ -97,4 +93,3 @@ public String getShowId() {
9793
}
9894

9995
}
100-

cuebot/src/main/java/com/imageworks/spcue/ActionInterface.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22
/*
33
* Copyright Contributors to the OpenCue Project
44
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
87
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
109
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License
11+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
* or implied. See the License for the specific language governing permissions and limitations under
13+
* the License.
1614
*/
1715

18-
19-
2016
package com.imageworks.spcue;
2117

2218
public interface ActionInterface extends FilterInterface {
2319

2420
public String getActionId();
2521

2622
}
27-

cuebot/src/main/java/com/imageworks/spcue/AllocationEntity.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22
/*
33
* Copyright Contributors to the OpenCue Project
44
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
87
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
109
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License
11+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
* or implied. See the License for the specific language governing permissions and limitations under
13+
* the License.
1614
*/
1715

18-
19-
2016
package com.imageworks.spcue;
2117

2218
public class AllocationEntity extends Entity implements AllocationInterface {
@@ -34,4 +30,3 @@ public String getFacilityId() {
3430
}
3531

3632
}
37-

cuebot/src/main/java/com/imageworks/spcue/AllocationInterface.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,20 @@
22
/*
33
* Copyright Contributors to the OpenCue Project
44
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
87
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
109
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License
11+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
* or implied. See the License for the specific language governing permissions and limitations under
13+
* the License.
1614
*/
1715

18-
19-
2016
package com.imageworks.spcue;
2117

2218
public interface AllocationInterface extends EntityInterface, FacilityInterface {
2319

2420
public String getAllocationId();
2521
}
26-

cuebot/src/main/java/com/imageworks/spcue/BuildableDependency.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22
/*
33
* Copyright Contributors to the OpenCue Project
44
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License. You may obtain a copy of the License at
87
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
109
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License
11+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
* or implied. See the License for the specific language governing permissions and limitations under
13+
* the License.
1614
*/
1715

18-
19-
2016
package com.imageworks.spcue;
2117

2218
import com.imageworks.spcue.grpc.depend.DependType;
@@ -120,4 +116,3 @@ public void setLaunchDepend(boolean launchDepend) {
120116
}
121117

122118
}
123-

0 commit comments

Comments
 (0)