Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve 2 spotbugs issues and increase spotbugs checks #100

Merged
merged 12 commits into from
Feb 11, 2023
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<revision>1.17</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.361.4</jenkins.version>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down Expand Up @@ -103,7 +105,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<!-- Version specified in parent POM -->
<version>3.2.1</version>
<configuration>
<consoleOutput>true</consoleOutput>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public GitLabAuthenticationToken(String accessToken, String gitlabServer, TokenT
authorities.add(SecurityRealm.AUTHENTICATED_AUTHORITY);
Jenkins jenkins = Jenkins.getInstanceOrNull();
if (jenkins != null && jenkins.getSecurityRealm() instanceof GitLabSecurityRealm) {
if (myRealm == null) {
myRealm = (GitLabSecurityRealm) jenkins.getSecurityRealm();
}

myRealm = (GitLabSecurityRealm) jenkins.getSecurityRealm();

// Search for scopes that allow fetching team membership. This is
// documented online.
// https://developer.gitlab.com/v3/orgs/#list-your-organizations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
/**
*
*/

package org.jenkinsci.plugins;

import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.userdetails.User;
import org.acegisecurity.userdetails.UserDetails;

/**
* @author Mike
*
*/
public class GitLabOAuthUserDetails extends User implements UserDetails {
public class GitLabOAuthUserDetails extends User {
MarkEWaite marked this conversation as resolved.
Show resolved Hide resolved

/**
*
*/
private static final long serialVersionUID = 1709511212188366292L;

public GitLabOAuthUserDetails(org.gitlab4j.api.models.User user, GrantedAuthority[] authorities) {
Expand Down
36 changes: 36 additions & 0 deletions src/spotbugs/excludesFilter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<FindBugsFilter>
<!--
Exclusions in this section have been triaged and determined to be
false positives.
-->

<!--
Here lies technical debt. Exclusions in this section have not yet
been triaged. When working on this section, pick an exclusion to
triage, then:

- Add a @SuppressFBWarnings(value = "[...]", justification = "[...]")
annotation if it is a false positive. Indicate the reason why
it is a false positive, then remove the exclusion from this
section.

- If it is not a false positive, fix the bug, then remove the
exclusion from this section.
-->
<Match>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
<Class name="org.jenkinsci.plugins.GitLabAuthenticationToken"/>
<Field name="gitLabAPI"/>
</Match>
<Match>
<Bug pattern="SE_TRANSIENT_FIELD_NOT_RESTORED"/>
<Class name="org.jenkinsci.plugins.GitLabAuthenticationToken"/>
<Field name="me"/>
</Match>
<Match>
<Bug pattern="DM_CONVERT_CASE"/>
<Class name="org.jenkinsci.plugins.GitLabSecurityRealm$ConverterImpl"/>
<Method name="setValue"/>
</Match>
</FindBugsFilter>