Skip to content

Commit 2af4f61

Browse files
committed
Cleanup imports
1 parent da11702 commit 2af4f61

54 files changed

Lines changed: 404 additions & 286 deletions

Some content is hidden

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

pom.xml

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<okhttp3.version>4.2.2</okhttp3.version>
3737
<okio.version>2.4.1</okio.version>
3838
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
39+
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
3940
<jacoco.coverage.target.class>.80</jacoco.coverage.target.class>
4041
<jacoco.coverage.target.method>0.20</jacoco.coverage.target.method>
4142
<jacoco.coverage.target.line>0.50</jacoco.coverage.target.line>
@@ -181,6 +182,23 @@
181182
</execution>
182183
</executions>
183184
</plugin>
185+
<plugin>
186+
<groupId>net.revelc.code</groupId>
187+
<artifactId>impsort-maven-plugin</artifactId>
188+
<version>1.3.2</version>
189+
<configuration>
190+
<groups>*,java.,javax.</groups>
191+
<removeUnused>true</removeUnused>
192+
<staticAfter>true</staticAfter>
193+
</configuration>
194+
<executions>
195+
<execution>
196+
<goals>
197+
<goal>${impsort-maven-plugin.goal}</goal>
198+
</goals>
199+
</execution>
200+
</executions>
201+
</plugin>
184202
<plugin>
185203
<groupId>com.github.spotbugs</groupId>
186204
<artifactId>spotbugs-maven-plugin</artifactId>
@@ -359,6 +377,7 @@
359377
<id>ci</id>
360378
<properties>
361379
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
380+
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
362381
</properties>
363382
<build>
364383
</build>
@@ -406,44 +425,44 @@
406425
<limits>
407426
<!-- These limits can be overridden, in the form of `0.50` for -->
408427
<!-- 50%, as necessary. Using a property just puts it in one spot. -->
409-
<!--
410-
<limit>
411-
<counter>LINE</counter>
412-
<value>COVEREDRATIO</value>
413-
<minimum>${jacoco.coverage.target.lines}</minimum>
414-
</limit>
415-
-->
416-
<!--
417-
<limit>
418-
<counter>BRANCH</counter>
419-
<value>COVEREDRATIO</value>
420-
<minimum>${jacoco.coverage.target.other}</minimum>
421-
</limit>
422-
-->
423-
<!--
424-
<limit>
425-
<counter>INSTRUCTION</counter>
426-
<value>COVEREDRATIO</value>
427-
<minimum>${jacoco.coverage.target.other}</minimum>
428-
</limit>
429-
-->
430-
<!--
431-
<limit>
432-
<counter>COMPLEXITY</counter>
433-
<value>COVEREDRATIO</value>
434-
<minimum>${jacoco.coverage.target.other}</minimum>
435-
</limit>
436-
-->
428+
<!--
429+
<limit>
430+
<counter>LINE</counter>
431+
<value>COVEREDRATIO</value>
432+
<minimum>${jacoco.coverage.target.lines}</minimum>
433+
</limit>
434+
-->
435+
<!--
436+
<limit>
437+
<counter>BRANCH</counter>
438+
<value>COVEREDRATIO</value>
439+
<minimum>${jacoco.coverage.target.other}</minimum>
440+
</limit>
441+
-->
442+
<!--
443+
<limit>
444+
<counter>INSTRUCTION</counter>
445+
<value>COVEREDRATIO</value>
446+
<minimum>${jacoco.coverage.target.other}</minimum>
447+
</limit>
448+
-->
449+
<!--
450+
<limit>
451+
<counter>COMPLEXITY</counter>
452+
<value>COVEREDRATIO</value>
453+
<minimum>${jacoco.coverage.target.other}</minimum>
454+
</limit>
455+
-->
437456
<limit>
438457
<counter>METHOD</counter>
439458
<value>COVEREDRATIO</value>
440459
<minimum>${jacoco.coverage.target.method}</minimum>
441460
</limit>
442-
<!-- <limit>-->
443-
<!-- <counter>CLASS</counter>-->
444-
<!-- <value>COVEREDRATIO</value>-->
445-
<!-- <minimum>${jacoco.coverage.target.class}</minimum>-->
446-
<!-- </limit>-->
461+
<!-- <limit>-->
462+
<!-- <counter>CLASS</counter>-->
463+
<!-- <value>COVEREDRATIO</value>-->
464+
<!-- <minimum>${jacoco.coverage.target.class}</minimum>-->
465+
<!-- </limit>-->
447466
</limits>
448467
<excludes>
449468
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory.**</exclude>
@@ -461,7 +480,7 @@
461480
</build>
462481
</profile>
463482
<profile>
464-
<id>release</id>
483+
<id>release</id>
465484
<build>
466485
<plugins>
467486
<plugin>

src/main/java/org/kohsuke/github/DeleteToken.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
/**
2929
* @author Kohsuke Kawaguchi
3030
*/
31-
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "Being constructed by JSON deserialization")
31+
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
32+
justification = "Being constructed by JSON deserialization")
3233
class DeleteToken {
3334
public String delete_token;
3435
}

src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
5555
@Preview
5656
@Deprecated
5757
public GHAppInstallationToken create() throws IOException {
58-
return builder.method("POST").withPreview(MACHINE_MAN).to(apiUrlTail, GHAppInstallationToken.class)
58+
return builder.method("POST")
59+
.withPreview(MACHINE_MAN)
60+
.to(apiUrlTail, GHAppInstallationToken.class)
5961
.wrapUp(root);
6062
}
6163

src/main/java/org/kohsuke/github/GHBranchProtection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
55

6-
import static org.kohsuke.github.Previews.ZZZAX;
7-
86
import java.io.IOException;
97
import java.util.Collection;
108

9+
import static org.kohsuke.github.Previews.ZZZAX;
10+
1111
/**
1212
* The type GHBranchProtection.
1313
*/

src/main/java/org/kohsuke/github/GHEvent.java

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,50 @@
1010
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
1111
*/
1212
public enum GHEvent {
13-
COMMIT_COMMENT, CREATE, DELETE, DEPLOYMENT, DEPLOYMENT_STATUS, DOWNLOAD, FOLLOW, FORK, FORK_APPLY, GIST, GOLLUM, INSTALLATION, INSTALLATION_REPOSITORIES, INTEGRATION_INSTALLATION_REPOSITORIES, CHECK_SUITE, ISSUE_COMMENT, ISSUES, LABEL, MARKETPLACE_PURCHASE, MEMBER, MEMBERSHIP, MILESTONE, ORGANIZATION, ORG_BLOCK, PAGE_BUILD, PROJECT_CARD, PROJECT_COLUMN, PROJECT, PUBLIC, PULL_REQUEST, PULL_REQUEST_REVIEW, PULL_REQUEST_REVIEW_COMMENT, PUSH, RELEASE, REPOSITORY, // only
14-
// valid
15-
// for
16-
// org
17-
// hooks
18-
STATUS, TEAM, TEAM_ADD, WATCH, PING,
13+
COMMIT_COMMENT,
14+
CREATE,
15+
DELETE,
16+
DEPLOYMENT,
17+
DEPLOYMENT_STATUS,
18+
DOWNLOAD,
19+
FOLLOW,
20+
FORK,
21+
FORK_APPLY,
22+
GIST,
23+
GOLLUM,
24+
INSTALLATION,
25+
INSTALLATION_REPOSITORIES,
26+
INTEGRATION_INSTALLATION_REPOSITORIES,
27+
CHECK_SUITE,
28+
ISSUE_COMMENT,
29+
ISSUES,
30+
LABEL,
31+
MARKETPLACE_PURCHASE,
32+
MEMBER,
33+
MEMBERSHIP,
34+
MILESTONE,
35+
ORGANIZATION,
36+
ORG_BLOCK,
37+
PAGE_BUILD,
38+
PROJECT_CARD,
39+
PROJECT_COLUMN,
40+
PROJECT,
41+
PUBLIC,
42+
PULL_REQUEST,
43+
PULL_REQUEST_REVIEW,
44+
PULL_REQUEST_REVIEW_COMMENT,
45+
PUSH,
46+
RELEASE,
47+
REPOSITORY, // only
48+
// valid
49+
// for
50+
// org
51+
// hooks
52+
STATUS,
53+
TEAM,
54+
TEAM_ADD,
55+
WATCH,
56+
PING,
1957
/**
2058
* Special event type that means "every possible event"
2159
*/

src/main/java/org/kohsuke/github/GHFileNotFoundException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package org.kohsuke.github;
22

3-
import javax.annotation.CheckForNull;
43
import java.io.FileNotFoundException;
54
import java.net.HttpURLConnection;
65
import java.util.List;
76
import java.util.Map;
87

8+
import javax.annotation.CheckForNull;
9+
910
/**
1011
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
1112
*

src/main/java/org/kohsuke/github/GHIOException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package org.kohsuke.github;
22

3-
import javax.annotation.CheckForNull;
43
import java.io.IOException;
54
import java.net.HttpURLConnection;
65
import java.util.List;
76
import java.util.Map;
87

8+
import javax.annotation.CheckForNull;
9+
910
/**
1011
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
1112
*

src/main/java/org/kohsuke/github/GHIssue.java

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,20 @@
2424

2525
package org.kohsuke.github;
2626

27-
import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
28-
2927
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
3028
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
29+
3130
import java.io.IOException;
3231
import java.net.URL;
3332
import java.util.ArrayList;
3433
import java.util.Arrays;
3534
import java.util.Collection;
3635
import java.util.Collections;
3736
import java.util.Date;
38-
import java.util.HashSet;
3937
import java.util.List;
4038
import java.util.Locale;
41-
import java.util.Set;
39+
40+
import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
4241

4342
/**
4443
* Represents an issue on GitHub.
@@ -179,7 +178,7 @@ public Collection<GHLabel> getLabels() throws IOException {
179178
if (labels == null) {
180179
return Collections.emptyList();
181180
}
182-
return Collections.<GHLabel> unmodifiableList(labels);
181+
return Collections.<GHLabel>unmodifiableList(labels);
183182
}
184183

185184
/**
@@ -231,8 +230,8 @@ public void unlock() throws IOException {
231230
*/
232231
@WithBridgeMethods(void.class)
233232
public GHIssueComment comment(String message) throws IOException {
234-
GHIssueComment r = new Requester(root).with("body", message).to(getIssuesApiRoute() + "/comments",
235-
GHIssueComment.class);
233+
GHIssueComment r = new Requester(root).with("body", message)
234+
.to(getIssuesApiRoute() + "/comments", GHIssueComment.class);
236235
return r.wrapUp(this);
237236
}
238237

@@ -443,22 +442,27 @@ public List<GHIssueComment> getComments() throws IOException {
443442
* the io exception
444443
*/
445444
public PagedIterable<GHIssueComment> listComments() throws IOException {
446-
return root.retrieve().asPagedIterable(getIssuesApiRoute() + "/comments", GHIssueComment[].class,
447-
item -> item.wrapUp(GHIssue.this));
445+
return root.retrieve()
446+
.asPagedIterable(getIssuesApiRoute() + "/comments",
447+
GHIssueComment[].class,
448+
item -> item.wrapUp(GHIssue.this));
448449
}
449450

450451
@Preview
451452
@Deprecated
452453
public GHReaction createReaction(ReactionContent content) throws IOException {
453-
return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
454-
.to(getApiRoute() + "/reactions", GHReaction.class).wrap(root);
454+
return new Requester(owner.root).withPreview(SQUIRREL_GIRL)
455+
.with("content", content.getContent())
456+
.to(getApiRoute() + "/reactions", GHReaction.class)
457+
.wrap(root);
455458
}
456459

457460
@Preview
458461
@Deprecated
459462
public PagedIterable<GHReaction> listReactions() {
460-
return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
461-
GHReaction[].class, item -> item.wrap(owner.root));
463+
return owner.root.retrieve()
464+
.withPreview(SQUIRREL_GIRL)
465+
.asPagedIterable(getApiRoute() + "/reactions", GHReaction[].class, item -> item.wrap(owner.root));
462466
}
463467

464468
/**
@@ -482,8 +486,10 @@ public void addAssignees(GHUser... assignees) throws IOException {
482486
* the io exception
483487
*/
484488
public void addAssignees(Collection<GHUser> assignees) throws IOException {
485-
root.retrieve().method("POST").with(ASSIGNEES, getLogins(assignees)).to(getIssuesApiRoute() + "/assignees",
486-
this);
489+
root.retrieve()
490+
.method("POST")
491+
.with(ASSIGNEES, getLogins(assignees))
492+
.to(getIssuesApiRoute() + "/assignees", this);
487493
}
488494

489495
/**
@@ -531,7 +537,10 @@ public void removeAssignees(GHUser... assignees) throws IOException {
531537
* the io exception
532538
*/
533539
public void removeAssignees(Collection<GHUser> assignees) throws IOException {
534-
root.retrieve().method("DELETE").with(ASSIGNEES, getLogins(assignees)).inBody()
540+
root.retrieve()
541+
.method("DELETE")
542+
.with(ASSIGNEES, getLogins(assignees))
543+
.inBody()
535544
.to(getIssuesApiRoute() + "/assignees", this);
536545
}
537546

@@ -645,8 +654,8 @@ public GHMilestone getMilestone() {
645654
/**
646655
* The type PullRequest.
647656
*/
648-
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
649-
"UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
657+
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
658+
justification = "JSON API")
650659
public static class PullRequest {
651660
private String diff_url, patch_url, html_url;
652661

@@ -694,7 +703,9 @@ protected static List<String> getLogins(Collection<GHUser> users) {
694703
* the io exception
695704
*/
696705
public PagedIterable<GHIssueEvent> listEvents() throws IOException {
697-
return root.retrieve().asPagedIterable(owner.getApiTailUrl(String.format("/issues/%s/events", number)),
698-
GHIssueEvent[].class, item -> item.wrapUp(GHIssue.this));
706+
return root.retrieve()
707+
.asPagedIterable(owner.getApiTailUrl(String.format("/issues/%s/events", number)),
708+
GHIssueEvent[].class,
709+
item -> item.wrapUp(GHIssue.this));
699710
}
700711
}

src/main/java/org/kohsuke/github/GHObject.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
66
import org.apache.commons.lang3.builder.ToStringStyle;
77

8-
import javax.annotation.CheckForNull;
98
import java.io.IOException;
109
import java.lang.reflect.Field;
1110
import java.net.URL;
1211
import java.util.Date;
1312
import java.util.List;
1413
import java.util.Map;
1514

15+
import javax.annotation.CheckForNull;
16+
1617
/**
1718
* Most (all?) domain objects in GitHub seems to have these 4 properties.
1819
*/

src/main/java/org/kohsuke/github/GHOrganization.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.List;
1010
import java.util.Map;
1111
import java.util.TreeMap;
12+
1213
import static org.kohsuke.github.Previews.INERTIA;
1314

1415
/**

0 commit comments

Comments
 (0)