Skip to content

Commit 7b9e073

Browse files
authored
Merge pull request #537 from jeetchoudhary/master
updating source code per java-doc standards
2 parents c8a01f7 + 0821b33 commit 7b9e073

File tree

9 files changed

+35
-13
lines changed

9 files changed

+35
-13
lines changed

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/model/FromInstruction.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ private FromInstruction(String baseImageName, String tag, List<String> additiona
9292
}
9393

9494
/**
95-
* Check if this {@code lineInFile} is a FROM instruction, it is referencing {@code imageName} as a base image,
96-
* and the tag is not the same as {@code imageTag} (or there is no tag)
97-
*
98-
* @param lineInFile a single line from a file
99-
* @param imageName the base image name we're looking for
100-
* @param imageTag the proposed new tag
95+
* Check if this {@code lineInFile} is a FROM instruction,
96+
* it is referencing {@code imageName} as a base image,
97+
* and the tag is not the same as {@code imageTag} (or there is no tag)
98+
* @param lineInFile Line a code file
99+
* @param imageName images name
100+
* @param imageTag tag for imageName
101+
* @return {@link Boolean} value isFromInstructionWithThisImageAndOlderTag
101102
*/
102103
public static boolean isFromInstructionWithThisImageAndOlderTag(String lineInFile, String imageName, String imageTag) {
103104
if (FromInstruction.isFromInstruction(lineInFile)) {

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/model/ShouldForkResult.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ public static ShouldForkResult shouldNotForkResult(String reason) {
2525
return new ShouldForkResult(false, reason);
2626
}
2727

28+
2829
/**
29-
* Allows for chaining ShouldForkResult instances such that and() will return the first
30-
* ShouldForkResult which results in isForkable() == false.
31-
*
30+
* Allows for chaining ShouldForkResult instances such that and() will
31+
* return the first ShouldForkResult which results in isForkable() == false.
3232
* @param otherShouldForkResult the other ShouldForkResult to return if this is forkable.
33+
* @return chainable {@code ShouldForkResult}
3334
*/
3435
public ShouldForkResult and(ShouldForkResult otherShouldForkResult) {
3536
if (isForkable()) {

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/process/ForkableRepoValidator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public ForkableRepoValidator(DockerfileGitHubUtil dockerfileGitHubUtil) {
4141
*
4242
* @param parentRepo parent repo we're checking
4343
* @param searchResultContent search result content we'll check against
44+
* @param gitForkBranch forked git branch
4445
* @return should we fork the parentRepo?
4546
*/
4647
public ShouldForkResult shouldFork(GHRepository parentRepo,
@@ -57,7 +58,8 @@ public ShouldForkResult shouldFork(GHRepository parentRepo,
5758
* whether that content has a qualifying base image update
5859
* @param parentRepo parentRepo which we'd fork off of
5960
* @param searchResultContent search result with path to check in parent repo's default branch (where we'd PR)
60-
* @param gitForkBranch information about the imageName we'd like to update with the new tag
61+
* @param gitForkBranch information about the imageName we'd like to update with the new tag.
62+
* @return {@code ShouldForkResult } Object
6163
*/
6264
protected ShouldForkResult contentHasChangesInDefaultBranch(GHRepository parentRepo,
6365
GHContent searchResultContent,
@@ -90,6 +92,7 @@ protected ShouldForkResult contentHasChangesInDefaultBranch(GHRepository parentR
9092
*
9193
* @param content content to check
9294
* @param gitForkBranch information about the base image we'd like to update
95+
* @return {@code Boolean} value signifying whether there are any changes content
9396
*/
9497
protected boolean hasNoChanges(GHContent content, GitForkBranch gitForkBranch) {
9598
try (InputStream stream = content.read();
@@ -115,6 +118,7 @@ protected boolean hasNoChanges(GHContent content, GitForkBranch gitForkBranch) {
115118
* If this user is the owner of the repo, do not fork.
116119
*
117120
* @param parentRepo parent repo we're checking
121+
* @return {@code ShouldForkResult} Object abstracting data if the user is owner of the repo
118122
*/
119123
protected ShouldForkResult thisUserIsNotOwner(GHRepository parentRepo) {
120124
try {
@@ -131,6 +135,7 @@ protected ShouldForkResult thisUserIsNotOwner(GHRepository parentRepo) {
131135
* Check if parentRepo is a fork. Do not fork a fork (for now, at least).
132136
*
133137
* @param parentRepo parent repo we're checking
138+
* @return {@code ShouldForkResult} Object abstracting data if parentRepo is a fork
134139
*/
135140
protected ShouldForkResult parentIsFork(GHRepository parentRepo) {
136141
return parentRepo.isFork() ? shouldNotForkResult(REPO_IS_FORK) : shouldForkResult();
@@ -140,6 +145,7 @@ protected ShouldForkResult parentIsFork(GHRepository parentRepo) {
140145
* Check if parentRepo is archived. We won't be able to update it, so do not fork.
141146
*
142147
* @param parentRepo parent repo we're checking
148+
* @return {@code ShouldForkResult} Object abstracting data if parentRepo is archived
143149
*/
144150
protected ShouldForkResult parentIsArchived(GHRepository parentRepo) {
145151
return parentRepo.isArchived() ? shouldNotForkResult(REPO_IS_ARCHIVED) : shouldForkResult();

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/process/GitHubPullRequestSender.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ private void ensureForkedAndAddToListForProcessing(Multimap<String, GitHubConten
114114
*
115115
* @param pathToDockerfilesInParentRepo processing multimap
116116
* @param parentRepoName name of parent repo to find
117+
* @return {@code GHRepository} return the fork from existing record
117118
*/
118119
protected GHRepository getForkFromExistingRecordToProcess(Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo,
119120
String parentRepoName) {

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/storage/GitHubJsonStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ public void updateStore(String img, String tag) throws IOException {
5959
}
6060

6161
/**
62-
* This methods will check if the tag store at {@param path}
62+
* This methods will check if the tag store at path
6363
* is created or not, if not it will create a new tag store.
6464
*
6565
* @param repo {@link GHRepository} git repository object.
6666
* @param path filename with path with in repo for the tag store.
67-
* @throws IOException when tag store at {@param path}
67+
* @throws IOException when tag store at path
6868
* can not be created.
6969
*/
7070
public void initializeTagStoreIfRequired(GHRepository repo, String path) throws IOException {

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/storage/ImageTagStore.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public interface ImageTagStore {
1616
*
1717
* @param img the name of the image that needs to be updated.
1818
* @param tag the version of the image that it needs to update to.
19+
* @throws IOException when fails to update tag store
1920
*/
2021
void updateStore(String img, String tag) throws IOException;
2122

@@ -25,6 +26,9 @@ public interface ImageTagStore {
2526
* @param dockerfileGitHubUtil the dockerfileGitHubUtil object that is used to interact with an underlying Git repo.
2627
* @param storeName the name of the store whose content needs to be fetched.
2728
* @return A Map of image name to image version.
29+
* @throws IOException when fails to get the tag store content
30+
* @throws InterruptedException when interrupted while getting the tag store content
2831
*/
32+
2933
List<ImageTagStoreContent> getStoreContent(DockerfileGitHubUtil dockerfileGitHubUtil, String storeName) throws IOException, InterruptedException;
3034
}

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/storage/S3BackedImageTagStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void updateStore(String img, String tag) throws IOException {
5151
/**
5252
* This method gets the content of the image tag store backed by S3.
5353
*
54-
* @param dockerfileGitHubUtil
54+
* @param dockerfileGitHubUtil {@code DockerfileGitHubUtil} Object
5555
* @param storeName The name of the store.
5656
* @return List of ImageTagStoreContent objects that contain the image name and the image tag.
5757
*/

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/DockerfileGitHubUtil.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ public Optional<GHPullRequest> getPullRequestForImageBranch(GHRepository reposit
398398
* @param parent parent repo to base from
399399
* @param fork fork repo where we'll create or modify the {@code gitForkBranch}
400400
* @param gitForkBranch desired branch to create or update based on the parent's default branch
401+
* @throws IOException if there is any failure while I/O.
402+
* @throws InterruptedException if interrupted during updating forked branch
401403
*/
402404
public void createOrUpdateForkBranchToParentDefault(GHRepository parent, GHRepository fork, GitForkBranch gitForkBranch) throws IOException, InterruptedException {
403405
GHBranch parentBranch = parent.getBranch(parent.getDefaultBranch());
@@ -433,6 +435,10 @@ public boolean thisUserIsOwner(GHRepository repo) throws IOException {
433435
*
434436
* @param org GitHub organization
435437
* @param img image to find
438+
* @param gitApiSearchLimit git api search limit
439+
* @throws IOException if there is any failure while I/O from git.
440+
* @throws InterruptedException if interrupted while fetching git content
441+
* @return {@code Optional} of {@code PagedSearchIterable}
436442
*/
437443
public Optional<List<PagedSearchIterable<GHContent>>> getGHContents(String org, String img, Integer gitApiSearchLimit)
438444
throws IOException, InterruptedException {

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/GitHubUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public GHRepository createFork(GHRepository repo) {
8383
/**
8484
* Attempt to delete the GitHub repo if there are no pull requests associated with it
8585
* @param repo the repo to delete
86+
* @throws IOException if fails to delete repo.
8687
*/
8788
public void safeDeleteRepo(GHRepository repo) throws IOException {
8889
if (!repo.queryPullRequests().state(GHIssueState.OPEN).list().iterator().hasNext()) {
@@ -142,6 +143,8 @@ public int createPullReq(GHRepository origRepo, String branch,
142143
*
143144
* @param repo - wait until we can retrieve {@code branch from this repo}
144145
* @param branchName - the branch to wait for
146+
* @return {@code GHBranch} Object for the branchName
147+
* @throws InterruptedException if interrupted while retrieving the branch
145148
*/
146149
protected GHBranch tryRetrievingBranch(GHRepository repo, String branchName) throws InterruptedException {
147150
for (int i = 0; i < 10; i++) {

0 commit comments

Comments
 (0)