Skip to content

Commit

Permalink
Spotless apply (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen authored Apr 28, 2023
1 parent 58ea42e commit a685a51
Show file tree
Hide file tree
Showing 69 changed files with 1,864 additions and 1,597 deletions.
20 changes: 0 additions & 20 deletions .mvn/checkstyle.xml

This file was deleted.

165 changes: 64 additions & 101 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,89 @@
<artifactId>gitlab-branch-source</artifactId>
<version>${changelist}</version>
<packaging>hpi</packaging>
<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.361.4</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
</properties>
<name>GitLab Branch Source Plugin</name>
<description>GitLab Provides branch source and folder organisation functionality for GitLab Repositories in Jenkins Source Plugin</description>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>

<scm>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.361.4</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<spotless.check.skip>false</spotless.check.skip>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.361.x</artifactId>
<version>2025.v816d28f1e04f</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>apache-httpcomponents-client-4-api</artifactId>
<groupId>io.jenkins.plugins</groupId>
<artifactId>gitlab-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<artifactId>apache-httpcomponents-client-4-api</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>gitlab-api</artifactId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>branch-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plain-credentials</artifactId>
<artifactId>git</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>handy-uri-templates-2-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<artifactId>plain-credentials</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins.configuration-as-code</groupId>
<artifactId>test-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
Expand All @@ -63,6 +105,11 @@
<artifactId>pipeline-build-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
Expand All @@ -80,119 +127,35 @@
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
<artifactId>workflow-durable-task-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<artifactId>workflow-multibranch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<artifactId>workflow-scm-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-multibranch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<artifactId>workflow-step-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<artifactId>workflow-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins</groupId>
<artifactId>configuration-as-code</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins.configuration-as-code</groupId>
<artifactId>test-harness</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>branch-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.361.x</artifactId>
<version>2025.v816d28f1e04f</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>

<scm>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>9.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>${project.basedir}/.mvn/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</sourceDirectories>
<testSourceDirectories>
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
</testSourceDirectories>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ public boolean isMatch(@NonNull SCM scm) {
protected abstract Map<SCMHead, SCMRevision> headsFor(GitLabSCMSource source);

public abstract GitLabWebHookCause getCause();

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public int getStrategyId() {
@Restricted(NoExternalUse.class)
public boolean isBuildBranch() {
return (strategyId & 1) != 0;

}

/**
Expand Down Expand Up @@ -168,15 +167,13 @@ public ListBoxModel doFillStrategyIdItems() {
/**
* Trusts branches from the origin repository.
*/
public static class BranchSCMHeadAuthority extends
SCMHeadAuthority<SCMSourceRequest, BranchSCMHead, SCMRevision> {
public static class BranchSCMHeadAuthority extends SCMHeadAuthority<SCMSourceRequest, BranchSCMHead, SCMRevision> {

/**
* {@inheritDoc}
*/
@Override
protected boolean checkTrusted(@NonNull SCMSourceRequest request,
@NonNull BranchSCMHead head) {
protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull BranchSCMHead head) {
return true;
}

Expand All @@ -191,8 +188,7 @@ public static class DescriptorImpl extends SCMHeadAuthorityDescriptor {
* {@inheritDoc}
*/
@Override
public boolean isApplicableToOrigin(
@NonNull Class<? extends SCMHeadOrigin> originClass) {
public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> originClass) {
return SCMHeadOrigin.Default.class.isAssignableFrom(originClass);
}

Expand All @@ -204,8 +200,6 @@ public boolean isApplicableToOrigin(
public String getDisplayName() {
return Messages.BranchDiscoveryTrait_authorityDisplayName();
}


}
}

Expand All @@ -223,7 +217,7 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he
for (MergeRequest m : ((GitLabSCMSourceRequest) request).getMergeRequests()) {
// only match if the merge request is an origin merge request
if (m.getSourceProjectId().equals(m.getTargetProjectId())
&& m.getSourceBranch().equalsIgnoreCase(head.getName())) {
&& m.getSourceBranch().equalsIgnoreCase(head.getName())) {
return true;
}
}
Expand All @@ -245,7 +239,7 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he
if (head instanceof BranchSCMHead && request instanceof GitLabSCMSourceRequest) {
for (MergeRequest m : ((GitLabSCMSourceRequest) request).getMergeRequests()) {
if (m.getSourceProjectId().equals(m.getTargetProjectId())
&& !m.getSourceBranch().equalsIgnoreCase(head.getName())) {
&& !m.getSourceBranch().equalsIgnoreCase(head.getName())) {
return true;
}
}
Expand All @@ -254,4 +248,3 @@ public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead he
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ public BranchSCMRevision(BranchSCMHead head, String hash) {
super(head, hash);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public String getBuildStatusNameCustomPart() {
*
* @return build status name overwrite option
*/
public boolean getBuildStatusNameOverwrite() { return buildStatusNameOverwrite; }
public boolean getBuildStatusNameOverwrite() {
return buildStatusNameOverwrite;
}

/**
* Our descriptor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ public static int defaultListSize(List<?> anyList) {
return anyList == null ? 0 : anyList.size();
}

public static String defaultLabelString (LabelType labelType) {
public static String defaultLabelString(LabelType labelType) {
return labelType == null ? "" : labelType.toString();
}

public static String defaultBooleanString(Boolean bool) {
public static String defaultBooleanString(Boolean bool) {
return bool == null ? "" : bool.toString();
}

public static String defaultVisibilityString(AccessLevel accessLevel) {
public static String defaultVisibilityString(AccessLevel accessLevel) {
return accessLevel == null ? "" : accessLevel.toString();
}

public static String defaultDateString(Date date) {
public static String defaultDateString(Date date) {
return date == null ? "" : date.toString();
}

public static String defaultIntString(Integer val) {
public static String defaultIntString(Integer val) {
return val == null ? "" : val.toString();
}

public static String defaultLongString(Long val) {
public static String defaultLongString(Long val) {
return val == null ? "" : val.toString();
}
}
Loading

0 comments on commit a685a51

Please sign in to comment.