Skip to content

Commit

Permalink
resolver codenarc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Echavarria committed Sep 16, 2024
1 parent ce6cec6 commit 2be7f4a
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,16 @@ class FileSystemWrapperFactory {

private static FileSystemWrapper fromSCM(FlowExecutionOwner owner, WorkflowJob job, SCM scm) {
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: scm)
FileSystemWrapper fsw
if (CACHE.containsKey(cacheKey)) {
return CACHE.get(cacheKey)
fsw = CACHE.get(cacheKey)
} else {
SCMFileSystem fs
fs = SCMFileSystem.of(job, scm)
FileSystemWrapper fsw = new FileSystemWrapper(fs: fs, scmKey: scm.getKey(), owner: owner)
fsw = new FileSystemWrapper(fs: fs, scmKey: scm.getKey(), owner: owner)
CACHE.put(cacheKey, fsw)
return fsw
}
return fsw
}

private static FileSystemWrapper fromMultiBranchProject(FlowExecutionOwner owner, WorkflowJob job, TaskListener listener){
Expand All @@ -139,30 +140,32 @@ class FileSystemWrapperFactory {
SCMHead head = branch.getHead()
SCMRevision tip = scmSource.fetch(head, listener)

FileSystemWrapper fsw
SCMFileSystem fs
String scmKey
if (tip) {
scmKey = branch.getScm().getKey()
SCMRevision rev = scmSource.getTrustedRevision(tip, listener)
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scmSource: scmSource, scmHead: head, scmRevision: rev)
if (CACHE.containsKey(cacheKey)) {
fs = CACHE.get(cacheKey)
fsw = CACHE.get(cacheKey)
} else {
fs = SCMFileSystem.of(scmSource, head, rev)
CACHE.put(cacheKey, fs)
fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
CACHE.put(cacheKey, fsw)
}
} else {
SCM jobSCM = branch.getScm()
scmKey = jobSCM.getKey()
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: jobSCM)
if (CACHE.containsKey(cacheKey)) {
fs = CACHE.get(cacheKey)
fsw = CACHE.get(cacheKey)
} else {
fs = SCMFileSystem.of(job, jobSCM)
CACHE.put(cacheKey, fs)
fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
CACHE.put(cacheKey, fsw)
}
}
FileSystemWrapper fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
return fsw
}

Expand All @@ -171,13 +174,14 @@ class FileSystemWrapperFactory {
SCM jobSCM = definition.getScm()
String scmKey = jobSCM.getKey()
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: jobSCM)
FileSystemWrapper fsw
if (CACHE.containsKey(cacheKey)) {
return CACHE.get(cacheKey)
fsw = CACHE.get(cacheKey)
} else {
SCMFileSystem fs = SCMFileSystem.of(job, jobSCM)
FileSystemWrapper fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
CACHE.put(cacheKey, fs)
return fsw
fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
CACHE.put(cacheKey, fsw)
}
return fsw
}
}

0 comments on commit 2be7f4a

Please sign in to comment.