Skip to content

Commit

Permalink
Update based on new settings
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Feb 23, 2021
1 parent d856f83 commit ea6e28c
Show file tree
Hide file tree
Showing 36 changed files with 268 additions and 438 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public abstract class AbstractGitHubNotificationStrategy {
/**
* Creates the list of {@link GitHubNotificationRequest} for the given context.
*
* @param notificationContext
* {@link GitHubNotificationContext} the context details
* @param listener
* the listener
* @param notificationContext {@link GitHubNotificationContext} the context details
* @param listener the listener
* @return a list of notification requests
* @since 2.3.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ public class BranchDiscoveryTrait extends SCMSourceTrait {
/**
* Constructor for stapler.
*
* @param strategyId
* the strategy id.
* @param strategyId the strategy id.
*/
@DataBoundConstructor
public BranchDiscoveryTrait(int strategyId) {
Expand All @@ -88,10 +87,8 @@ public BranchDiscoveryTrait(int strategyId) {
/**
* Constructor for legacy code.
*
* @param buildBranch
* build branches that are not filed as a PR.
* @param buildBranchWithPr
* build branches that are also PRs.
* @param buildBranch build branches that are not filed as a PR.
* @param buildBranchWithPr build branches that are also PRs.
*/
public BranchDiscoveryTrait(boolean buildBranch, boolean buildBranchWithPr) {
this.strategyId = (buildBranch ? EXCLUDE_PRS : NONE) + (buildBranchWithPr ? ONLY_PRS : NONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public String getPronoun() {
@Restricted(NoExternalUse.class)
@Extension
public static class MigrationImpl
extends
SCMHeadMigration<GitHubSCMSource, SCMHead, AbstractGitSCMSource.SCMRevisionImpl> {
extends SCMHeadMigration<GitHubSCMSource, SCMHead, AbstractGitSCMSource.SCMRevisionImpl> {
public MigrationImpl() {
super(GitHubSCMSource.class, SCMHead.class, AbstractGitSCMSource.SCMRevisionImpl.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ private Connector() {
/**
* Retained for binary compatibility only.
*
* @param context
* the context.
* @param apiUri
* the api endpoint.
* @param context the context.
* @param apiUri the api endpoint.
* @return a {@link ListBoxModel}.
* @deprecated use {@link #listCheckoutCredentials(Item, String)}.
*/
Expand All @@ -132,10 +130,8 @@ public static ListBoxModel listScanCredentials(@CheckForNull SCMSourceOwner cont
* Populates a {@link ListBoxModel} with the scan credentials appropriate for the supplied context against the
* supplied API endpoint.
*
* @param context
* the context.
* @param apiUri
* the api endpoint.
* @param context the context.
* @param apiUri the api endpoint.
* @return a {@link ListBoxModel}.
*/
@NonNull
Expand All @@ -152,12 +148,9 @@ public static ListBoxModel listScanCredentials(@CheckForNull Item context, Strin
/**
* Retained for binary compatibility only.
*
* @param context
* the context.
* @param apiUri
* the api endpoint.
* @param scanCredentialsId
* the credentials ID.
* @param context the context.
* @param apiUri the api endpoint.
* @param scanCredentialsId the credentials ID.
* @return the {@link FormValidation} results.
* @deprecated use {@link #checkScanCredentials(Item, String, String)}
*/
Expand All @@ -172,12 +165,9 @@ public static FormValidation checkScanCredentials(
/**
* Checks the credential ID for use as scan credentials in the supplied context against the supplied API endpoint.
*
* @param context
* the context.
* @param apiUri
* the api endpoint.
* @param scanCredentialsId
* the credentials ID.
* @param context the context.
* @param apiUri the api endpoint.
* @param scanCredentialsId the credentials ID.
* @return the {@link FormValidation} results.
*/
public static FormValidation checkScanCredentials(
Expand Down Expand Up @@ -246,12 +236,9 @@ public static FormValidation checkScanCredentials(
/**
* Retained for binary compatibility only.
*
* @param context
* the context.
* @param apiUri
* the API endpoint.
* @param scanCredentialsId
* the credentials to resolve.
* @param context the context.
* @param apiUri the API endpoint.
* @param scanCredentialsId the credentials to resolve.
* @return the {@link StandardCredentials} or {@code null}
* @deprecated use {@link #lookupScanCredentials(Item, String, String)}
*/
Expand All @@ -267,12 +254,9 @@ public static StandardCredentials lookupScanCredentials(
/**
* Resolves the specified scan credentials in the specified context for use against the specified API endpoint.
*
* @param context
* the context.
* @param apiUri
* the API endpoint.
* @param scanCredentialsId
* the credentials to resolve.
* @param context the context.
* @param apiUri the API endpoint.
* @param scanCredentialsId the credentials to resolve.
* @return the {@link StandardCredentials} or {@code null}
*/
@CheckForNull
Expand All @@ -286,8 +270,7 @@ public static StandardCredentials lookupScanCredentials(
return CredentialsMatchers.firstOrNull(
CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class,
context,
context instanceof Queue.Task
? ((Queue.Task) context).getDefaultAuthentication()
context instanceof Queue.Task ? ((Queue.Task) context).getDefaultAuthentication()
: ACL.SYSTEM,
githubDomainRequirements(apiUri)),
CredentialsMatchers.allOf(CredentialsMatchers.withId(scanCredentialsId),
Expand All @@ -298,10 +281,8 @@ public static StandardCredentials lookupScanCredentials(
/**
* Retained for binary compatibility only.
*
* @param context
* the context.
* @param apiUri
* the API endpoint.
* @param context the context.
* @param apiUri the API endpoint.
* @return the {@link StandardCredentials} or {@code null}
* @deprecated use {@link #listCheckoutCredentials(Item, String)}
*/
Expand All @@ -314,10 +295,8 @@ public static ListBoxModel listCheckoutCredentials(@CheckForNull SCMSourceOwner
* Populates a {@link ListBoxModel} with the checkout credentials appropriate for the supplied context against the
* supplied API endpoint.
*
* @param context
* the context.
* @param apiUri
* the api endpoint.
* @param context the context.
* @param apiUri the api endpoint.
* @return a {@link ListBoxModel}.
*/
@NonNull
Expand Down Expand Up @@ -426,11 +405,9 @@ record = GitHubConnection
*
* This method intentionally does not support caching requests or {@link GitHub} instances.
*
* @param apiUrl
* the GitHub API URL to be used for the connection
* @param apiUrl the GitHub API URL to be used for the connection
* @return a configured GitHubBuilder instance
* @throws IOException
* if I/O error occurs
* @throws IOException if I/O error occurs
*/
static GitHubBuilder createGitHubBuilder(@Nonnull String apiUrl) throws IOException {
return createGitHubBuilder(apiUrl, null);
Expand Down Expand Up @@ -522,8 +499,7 @@ static List<DomainRequirement> githubDomainRequirements(String apiUri) {
/**
* Uses proxy if configured on pluginManager/advanced page
*
* @param host
* GitHub's hostname to build proxy to
* @param host GitHub's hostname to build proxy to
*
* @return proxy to use it in connector. Should not be null as it can lead to unexpected behaviour
*/
Expand Down Expand Up @@ -562,8 +538,7 @@ public void onError(IOException e, HttpURLConnection uc) throws IOException {
* Alternative to {@link GitHub#isCredentialValid()} that relies on the cached user object in the {@link GitHub}
* instance and hence reduced rate limit consumption.
*
* @param gitHub
* the instance to check.
* @param gitHub the instance to check.
* @return {@code true} if the credentials are valid.
*/
static boolean isCredentialValid(GitHub gitHub) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ public class ForkPullRequestDiscoveryTrait extends SCMSourceTrait {
/**
* Constructor for stapler.
*
* @param strategyId
* the strategy id.
* @param trust
* the authority to use.
* @param strategyId the strategy id.
* @param trust the authority to use.
*/
@DataBoundConstructor
public ForkPullRequestDiscoveryTrait(
Expand All @@ -101,10 +99,8 @@ public ForkPullRequestDiscoveryTrait(
/**
* Constructor for programmatic instantiation.
*
* @param strategies
* the {@link ChangeRequestCheckoutStrategy} instances.
* @param trust
* the authority.
* @param strategies the {@link ChangeRequestCheckoutStrategy} instances.
* @param trust the authority.
*/
public ForkPullRequestDiscoveryTrait(
@NonNull Set<ChangeRequestCheckoutStrategy> strategies,
Expand Down Expand Up @@ -250,8 +246,7 @@ public List<SCMHeadAuthorityDescriptor> getTrustDescriptors() {
* An {@link SCMHeadAuthority} that trusts nothing.
*/
public static class TrustNobody
extends
SCMHeadAuthority<SCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
extends SCMHeadAuthority<SCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {

/**
* Constructor.
Expand Down Expand Up @@ -297,8 +292,7 @@ public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> orig
* An {@link SCMHeadAuthority} that trusts contributors to the repository.
*/
public static class TrustContributors
extends
SCMHeadAuthority<GitHubSCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
extends SCMHeadAuthority<GitHubSCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
/**
* Constructor.
*/
Expand Down Expand Up @@ -345,8 +339,7 @@ public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> orig
* An {@link SCMHeadAuthority} that trusts those with write permission to the repository.
*/
public static class TrustPermission
extends
SCMHeadAuthority<GitHubSCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
extends SCMHeadAuthority<GitHubSCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {

/**
* Constructor.
Expand Down Expand Up @@ -403,8 +396,7 @@ public boolean isApplicableToOrigin(@NonNull Class<? extends SCMHeadOrigin> orig
* An {@link SCMHeadAuthority} that trusts everyone.
*/
public static class TrustEveryone
extends
SCMHeadAuthority<SCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
extends SCMHeadAuthority<SCMSourceRequest, PullRequestSCMHead, PullRequestSCMRevision> {
/**
* Constructor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,8 @@ static class AppInstallationToken implements Serializable {
* Within the bounds of {@link #NOT_STALE_MINIMUM_SECONDS} and {@link #STALE_AFTER_SECONDS}, tokens will become
* stale {@link #STALE_BEFORE_EXPIRATION_SECONDS} seconds before they expire.
*
* @param token
* the token string
* @param expirationEpochSeconds
* the time in epoch seconds that this token will expire
* @param token the token string
* @param expirationEpochSeconds the time in epoch seconds that this token will expire
*/
public AppInstallationToken(Secret token, long expirationEpochSeconds) {
long now = Instant.now().getEpochSecond();
Expand Down Expand Up @@ -409,8 +407,7 @@ private Object writeReplace() {
}

private static final class DelegatingGitHubAppCredentials extends BaseStandardCredentials
implements
StandardUsernamePasswordCredentials {
implements StandardUsernamePasswordCredentials {

private final String appID;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ private static void createBuildCommitStatus(Run<?, ?> build, TaskListener listen
/**
* Returns the GitHub Repository associated to a Job.
*
* @param job
* A {@link Job}
* @param job A {@link Job}
* @return A {@link GHRepository} or null, either if a scan credentials was not provided, or a GitHubSCMSource was
* not defined.
* @throws IOException
Expand All @@ -158,8 +157,7 @@ private static GHRepository lookUpRepo(GitHub github, @NonNull Job<?, ?> job) th
/**
* Returns the GitHub Repository associated to a Job.
*
* @param job
* A {@link Job}
* @param job A {@link Job}
* @return A {@link GHRepository} or {@code null}, if any of: a credentials was not provided; notifications were
* disabled, or the job is not from a {@link GitHubSCMSource}.
* @throws IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public synchronized void setApiRateLimitChecker(@CheckForNull ApiRateLimitChecke
/**
* Fix an apiUri.
*
* @param apiUri
* the api URI.
* @param apiUri the api URI.
* @return the normalized api URI.
*/
@CheckForNull
Expand Down Expand Up @@ -141,8 +140,7 @@ public synchronized void setEndpoints(@CheckForNull List<Endpoint> endpoints) {
/**
* Adds an endpoint.
*
* @param endpoint
* the endpoint to add.
* @param endpoint the endpoint to add.
* @return {@code true} if the list of endpoints was modified
*/
public synchronized boolean addEndpoint(@NonNull Endpoint endpoint) {
Expand All @@ -163,8 +161,7 @@ public synchronized boolean addEndpoint(@NonNull Endpoint endpoint) {
/**
* Updates an existing endpoint (or adds if missing).
*
* @param endpoint
* the endpoint to update.
* @param endpoint the endpoint to update.
*/
public synchronized void updateEndpoint(@NonNull Endpoint endpoint) {
if (StringUtils.isBlank(endpoint.getApiUri())) {
Expand All @@ -189,8 +186,7 @@ public synchronized void updateEndpoint(@NonNull Endpoint endpoint) {
/**
* Removes an endpoint.
*
* @param endpoint
* the endpoint to remove.
* @param endpoint the endpoint to remove.
* @return {@code true} if the list of endpoints was modified
*/
public boolean removeEndpoint(@NonNull Endpoint endpoint) {
Expand All @@ -200,8 +196,7 @@ public boolean removeEndpoint(@NonNull Endpoint endpoint) {
/**
* Removes an endpoint.
*
* @param apiUri
* the API URI to remove.
* @param apiUri the API URI to remove.
* @return {@code true} if the list of endpoints was modified
*/
public synchronized boolean removeEndpoint(@CheckForNull String apiUri) {
Expand All @@ -221,8 +216,7 @@ public synchronized boolean removeEndpoint(@CheckForNull String apiUri) {
/**
* Checks to see if the supplied server URL is defined in the global configuration.
*
* @param apiUri
* the server url to check.
* @param apiUri the server url to check.
* @return the global configuration for the specified server url or {@code null} if not defined.
*/
@CheckForNull
Expand Down
Loading

0 comments on commit ea6e28c

Please sign in to comment.