Skip to content

Commit

Permalink
Merge pull request #616 from bitwiseman/impsort
Browse files Browse the repository at this point in the history
Cleanup imports
  • Loading branch information
bitwiseman authored Nov 19, 2019
2 parents d2ce7c1 + 82fa340 commit a969509
Show file tree
Hide file tree
Showing 106 changed files with 2,291 additions and 208 deletions.
87 changes: 53 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<okhttp3.version>4.2.2</okhttp3.version>
<okio.version>2.4.1</okio.version>
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
<jacoco.coverage.target.class>.80</jacoco.coverage.target.class>
<jacoco.coverage.target.method>0.20</jacoco.coverage.target.method>
<jacoco.coverage.target.line>0.50</jacoco.coverage.target.line>
Expand Down Expand Up @@ -181,6 +182,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<groups>*,java.,javax.</groups>
<removeUnused>true</removeUnused>
<staticAfter>true</staticAfter>
</configuration>
<executions>
<execution>
<goals>
<goal>${impsort-maven-plugin.goal}</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down Expand Up @@ -359,6 +377,7 @@
<id>ci</id>
<properties>
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
</properties>
<build>
</build>
Expand Down Expand Up @@ -406,44 +425,44 @@
<limits>
<!-- These limits can be overridden, in the form of `0.50` for -->
<!-- 50%, as necessary. Using a property just puts it in one spot. -->
<!--
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.lines}</minimum>
</limit>
-->
<!--
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.lines}</minimum>
</limit>
-->
<!--
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.method}</minimum>
</limit>
<!-- <limit>-->
<!-- <counter>CLASS</counter>-->
<!-- <value>COVEREDRATIO</value>-->
<!-- <minimum>${jacoco.coverage.target.class}</minimum>-->
<!-- </limit>-->
<!-- <limit>-->
<!-- <counter>CLASS</counter>-->
<!-- <value>COVEREDRATIO</value>-->
<!-- <minimum>${jacoco.coverage.target.class}</minimum>-->
<!-- </limit>-->
</limits>
<excludes>
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory.**</exclude>
Expand All @@ -461,7 +480,7 @@
</build>
</profile>
<profile>
<id>release</id>
<id>release</id>
<build>
<plugins>
<plugin>
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/kohsuke/github/GHApp.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.IOException;
import java.net.URL;
import java.util.List;
Expand All @@ -21,13 +19,10 @@ public class GHApp extends GHObject {
private GHUser owner;
private String name;
private String description;
@JsonProperty("external_url")
private String externalUrl;
private Map<String, String> permissions;
private List<GHEvent> events;
@JsonProperty("installations_count")
private long installationsCount;
@JsonProperty("html_url")
private String htmlUrl;

/**
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/kohsuke/github/GHAppInstallationToken.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

Expand All @@ -22,7 +21,6 @@ public class GHAppInstallationToken {
protected String expires_at;
private Map<String, String> permissions;
private List<GHRepository> repositories;
@JsonProperty("repository_selection")
private GHRepositorySelection repositorySelection;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHBranch.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonMappingException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.net.URL;
import java.util.Collection;
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/org/kohsuke/github/GHBranchProtection.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import static org.kohsuke.github.Previews.ZZZAX;

import java.io.IOException;
import java.util.Collection;

import static org.kohsuke.github.Previews.ZZZAX;

/**
* The type GHBranchProtection.
*/
Expand All @@ -18,15 +18,15 @@
public class GHBranchProtection {
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";

@JsonProperty("enforce_admins")
@JsonProperty
private EnforceAdmins enforceAdmins;

private GitHub root;

@JsonProperty("required_pull_request_reviews")
private RequiredReviews requiredReviews;

@JsonProperty("required_status_checks")
@JsonProperty
private RequiredStatusChecks requiredStatusChecks;

@JsonProperty
Expand Down Expand Up @@ -162,10 +162,8 @@ public static class RequiredReviews {
@JsonProperty("dismissal_restrictions")
private Restrictions dismissalRestriction;

@JsonProperty("dismiss_stale_reviews")
private boolean dismissStaleReviews;

@JsonProperty("require_code_owner_reviews")
private boolean requireCodeOwnerReviews;

@JsonProperty("required_approving_review_count")
Expand Down Expand Up @@ -294,7 +292,6 @@ public static class Restrictions {
@JsonProperty
private Collection<GHTeam> teams;

@JsonProperty("teams_url")
private String teamsUrl;

@JsonProperty
Expand All @@ -303,7 +300,6 @@ public static class Restrictions {
@JsonProperty
private Collection<GHUser> users;

@JsonProperty("users_url")
private String usersUrl;

/**
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/kohsuke/github/GHEventPayload.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

Expand Down Expand Up @@ -491,9 +490,7 @@ void wrapUp(GitHub root) {
justification = "Constructed by JSON deserialization")
public static class Create extends GHEventPayload {
private String ref;
@JsonProperty("ref_type")
private String refType;
@JsonProperty("master_branch")
private String masterBranch;
private String description;
private GHRepository repository;
Expand Down Expand Up @@ -575,7 +572,6 @@ void wrapUp(GitHub root) {
justification = "Constructed by JSON deserialization")
public static class Delete extends GHEventPayload {
private String ref;
@JsonProperty("ref_type")
private String refType;
private GHRepository repository;

Expand Down Expand Up @@ -695,7 +691,6 @@ void wrapUp(GitHub root) {
@SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
justification = "Constructed by JSON deserialization")
public static class DeploymentStatus extends GHEventPayload {
@JsonProperty("deployment_status")
private GHDeploymentStatus deploymentStatus;
private GHDeployment deployment;
private GHRepository repository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.kohsuke.github;

import javax.annotation.CheckForNull;
import java.io.FileNotFoundException;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

/**
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
*
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kohsuke/github/GHIOException.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.kohsuke.github;

import javax.annotation.CheckForNull;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

/**
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
*
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/kohsuke/github/GHIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@

package org.kohsuke.github;

import static org.kohsuke.github.Previews.SQUIRREL_GIRL;

import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import static org.kohsuke.github.Previews.SQUIRREL_GIRL;

/**
* Represents an issue on GitHub.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kohsuke/github/GHObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.annotation.CheckForNull;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.CheckForNull;

/**
* Most (all?) domain objects in GitHub seems to have these 4 properties.
*/
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/kohsuke/github/GHOrganization.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import static org.kohsuke.github.Previews.INERTIA;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kohsuke/github/GHPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.kohsuke.github;

import javax.annotation.CheckForNull;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
Expand All @@ -33,6 +32,8 @@
import java.util.Date;
import java.util.List;

import javax.annotation.CheckForNull;

import static org.kohsuke.github.Previews.SHADOW_CAT;

/**
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/kohsuke/github/GHPullRequestReview.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.util.Date;
import javax.annotation.CheckForNull;
import java.io.IOException;
import java.net.URL;
import java.util.Date;

import javax.annotation.CheckForNull;

/**
* Review to a pull request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.IOException;
import java.net.URL;

import javax.annotation.CheckForNull;

import static org.kohsuke.github.Previews.*;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kohsuke/github/GHRateLimit.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.StringUtils;

import javax.annotation.Nonnull;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.Objects;
import java.util.logging.Logger;

import javax.annotation.Nonnull;

import static java.util.logging.Level.FINEST;

/**
Expand Down
Loading

0 comments on commit a969509

Please sign in to comment.