Skip to content

Commit a15e67f

Browse files
committed
Switch formatting to spotless
This is change includes minimal changes required to make the switch
1 parent b3ff4ac commit a15e67f

File tree

4 files changed

+41
-44
lines changed

4 files changed

+41
-44
lines changed

pom.xml

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
<hamcrest.version>2.2</hamcrest.version>
4040
<okhttp3.version>4.4.1</okhttp3.version>
4141
<okio.version>2.5.0</okio.version>
42-
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
43-
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
42+
<spotless-maven-plugin.goal>apply</spotless-maven-plugin.goal>
4443
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
4544
<jacoco.coverage.target.bundle.method>0.60</jacoco.coverage.target.bundle.method>
4645
<jacoco.coverage.target.class.method>0.25</jacoco.coverage.target.class.method>
@@ -343,37 +342,30 @@
343342
</executions>
344343
</plugin>
345344
<plugin>
346-
<groupId>net.revelc.code.formatter</groupId>
347-
<artifactId>formatter-maven-plugin</artifactId>
348-
<version>2.12.1</version>
345+
<groupId>com.diffplug.spotless</groupId>
346+
<artifactId>spotless-maven-plugin</artifactId>
347+
<version>2.6.1</version>
349348
<executions>
350349
<execution>
350+
<id>spotless-check</id>
351+
<phase>process-sources</phase>
351352
<goals>
352-
<goal>${formatter-maven-plugin.goal}</goal>
353+
<goal>${spotless-maven-plugin.goal}</goal>
353354
</goals>
354-
<configuration>
355-
<configFile>src/main/resources/eclipse/formatter.xml</configFile>
356-
<cachedir>${project.build.directory}/.cache</cachedir>
357-
</configuration>
358355
</execution>
359356
</executions>
360-
</plugin>
361-
<plugin>
362-
<groupId>net.revelc.code</groupId>
363-
<artifactId>impsort-maven-plugin</artifactId>
364-
<version>1.4.1</version>
365357
<configuration>
366-
<groups>*,java.,javax.</groups>
367-
<removeUnused>true</removeUnused>
368-
<staticAfter>true</staticAfter>
358+
<java>
359+
<eclipse>
360+
<file>${basedir}/src/build/eclipse/formatter.xml</file>
361+
</eclipse>
362+
363+
<importOrder>
364+
<file>${basedir}/src/build/eclipse/eclipse.importorder</file>
365+
</importOrder>
366+
<removeUnusedImports />
367+
</java>
369368
</configuration>
370-
<executions>
371-
<execution>
372-
<goals>
373-
<goal>${impsort-maven-plugin.goal}</goal>
374-
</goals>
375-
</execution>
376-
</executions>
377369
</plugin>
378370
<plugin>
379371
<groupId>com.github.spotbugs</groupId>
@@ -595,8 +587,7 @@
595587
</os>
596588
</activation>
597589
<properties>
598-
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
599-
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
590+
<spotless-maven-plugin.goal>check</spotless-maven-plugin.goal>
600591
</properties>
601592
</profile>
602593
<profile>
@@ -621,8 +612,7 @@
621612
<profile>
622613
<id>release</id>
623614
<properties>
624-
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
625-
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
615+
<spotless-maven-plugin.goal>check</spotless-maven-plugin.goal>
626616
</properties>
627617
<build>
628618
<plugins>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Organize Import Order
2+
# Import this file in Window -> Preferences -> Java -> Code Style -> Organize Imports -> Import...
3+
0=
4+
1=java
5+
2=javax
6+
3=\#

src/main/java/org/kohsuke/github/extras/okhttp3/ObsoleteUrlFactory.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
package org.kohsuke.github.extras.okhttp3;
22

3+
/*
4+
* Copyright (C) 2014 Square, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
319
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
420
import okhttp3.Call;
521
import okhttp3.Callback;
@@ -21,21 +37,6 @@
2137
import okio.Pipe;
2238
import okio.Timeout;
2339

24-
/*
25-
* Copyright (C) 2014 Square, Inc.
26-
*
27-
* Licensed under the Apache License, Version 2.0 (the "License");
28-
* you may not use this file except in compliance with the License.
29-
* You may obtain a copy of the License at
30-
*
31-
* http://www.apache.org/licenses/LICENSE-2.0
32-
*
33-
* Unless required by applicable law or agreed to in writing, software
34-
* distributed under the License is distributed on an "AS IS" BASIS,
35-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36-
* See the License for the specific language governing permissions and
37-
* limitations under the License.
38-
*/
3940
import java.io.FileNotFoundException;
4041
import java.io.IOException;
4142
import java.io.InputStream;

0 commit comments

Comments
 (0)