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 29a2ec7 commit ce6cec6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ import org.jenkinsci.plugins.workflow.job.WorkflowJob
// this will copy their contents to ${jteDir} for the run
LinkedHashMap aggregatedConfig = config.getConfig()


aggregatedConfig[KEY].each{ libName, libConfig ->
LibraryProvider provider = providers.find{ provider ->
provider.hasLibrary(flowOwner, libName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FileSystemWrapperFactory {
* <p>This cache is a static attribute of the class, shared across all instances of {@code FileSystemCacheKey},
* and is initialized as an empty map, represented by {@code [:]}. It can grow dynamically as new entries are added during runtime.</p>
*/
private final static Map<FileSystemCacheKey, FileSystemWrapper> cache = [:]
private final static Map<FileSystemCacheKey, FileSystemWrapper> CACHE = [:]

/**
* Clears the cache for a specific {@link FlowExecutionOwner}.
Expand All @@ -69,7 +69,7 @@ class FileSystemWrapperFactory {
* @param owner the {@link FlowExecutionOwner} whose associated cache entries should be removed.
*/
static void clearCache(FlowExecutionOwner owner) {
cache.entrySet().removeIf { entry -> entry.getKey().getOwner() == owner }
CACHE.entrySet().removeIf { entry -> entry.getKey().getOwner() == owner }
}

/**
Expand Down Expand Up @@ -111,13 +111,13 @@ class FileSystemWrapperFactory {

private static FileSystemWrapper fromSCM(FlowExecutionOwner owner, WorkflowJob job, SCM scm) {
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: scm)
if (cache.containsKey(cacheKey)) {
return cache.get(cacheKey)
if (CACHE.containsKey(cacheKey)) {
return CACHE.get(cacheKey)
} else {
SCMFileSystem fs
fs = SCMFileSystem.of(job, scm)
FileSystemWrapper fsw = new FileSystemWrapper(fs: fs, scmKey: scm.getKey(), owner: owner)
cache.put(cacheKey, fsw)
CACHE.put(cacheKey, fsw)
return fsw
}
}
Expand Down Expand Up @@ -145,21 +145,21 @@ class FileSystemWrapperFactory {
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)
if (CACHE.containsKey(cacheKey)) {
fs = CACHE.get(cacheKey)
} else {
fs = SCMFileSystem.of(scmSource, head, rev)
cache.put(cacheKey, fs)
CACHE.put(cacheKey, fs)
}
} else {
SCM jobSCM = branch.getScm()
scmKey = jobSCM.getKey()
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: jobSCM)
if (cache.containsKey(cacheKey)) {
fs = cache.get(cacheKey)
if (CACHE.containsKey(cacheKey)) {
fs = CACHE.get(cacheKey)
} else {
fs = SCMFileSystem.of(job, jobSCM)
cache.put(cacheKey, fs)
CACHE.put(cacheKey, fs)
}
}
FileSystemWrapper fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
Expand All @@ -171,13 +171,12 @@ class FileSystemWrapperFactory {
SCM jobSCM = definition.getScm()
String scmKey = jobSCM.getKey()
FileSystemCacheKey cacheKey = new FileSystemCacheKey(owner: owner, scm: jobSCM)
if (cache.containsKey(cacheKey)) {
return cache.get(cacheKey)
if (CACHE.containsKey(cacheKey)) {
return CACHE.get(cacheKey)
} else {
SCMFileSystem fs = SCMFileSystem.of(job, jobSCM)
jobSCM.g
FileSystemWrapper fsw = new FileSystemWrapper(fs: fs, scmKey: scmKey, owner: owner)
cache.put(cacheKey, fs)
CACHE.put(cacheKey, fs)
return fsw
}
}
Expand Down

0 comments on commit ce6cec6

Please sign in to comment.