Skip to content

Commit

Permalink
Fixes violations for Codenarc check
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Apr 25, 2023
1 parent 1321e44 commit d92f28f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,12 +44,12 @@ abstract class CompileStaticGroovyPage extends GroovyPage {

@Override
Object getProperty(String property) {
return resolveProperty(property)
resolveProperty(property)
}

@Override
Object invokeMethod(String name, Object args) {
return defaultTagDispatcher.invokeMethod(name, args)
defaultTagDispatcher.invokeMethod(name, args)
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2022 the original author or authors.
* Copyright 2011-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,7 @@ class GroovyPagesMetaUtils {

GroovyObject mc = (GroovyObject) emc
synchronized (emc) {
mc.setProperty("methodMissing", { String name, Object args ->
mc.setProperty('methodMissing', { String name, Object args ->
TagLibraryMetaUtils.methodMissingForTagLib(emc, emc.getTheClass(), gspTagLibraryLookup,
GroovyPage.DEFAULT_NAMESPACE, name, args, addMethodsToMetaClass)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class ModelRecordingGroovyPage extends GroovyPage {
public static final String CONFIG_SYSTEM_PROPERTY_NAME
public static final boolean ENABLED
static {
CONFIG_SYSTEM_PROPERTY_NAME = "grails.views.gsp.modelrecording"
CONFIG_SYSTEM_PROPERTY_NAME = 'grails.views.gsp.modelrecording'
ENABLED = Boolean.getBoolean(CONFIG_SYSTEM_PROPERTY_NAME)
}
private static final ModelRecordingCache MODEL_RECORDING_CACHE = new ModelRecordingCache()
Expand All @@ -65,7 +65,7 @@ abstract class ModelRecordingGroovyPage extends GroovyPage {
if (value != null) {
modelEntry.taglibs.add(namespace)
}
return value
value
}

@Override
Expand All @@ -74,7 +74,7 @@ abstract class ModelRecordingGroovyPage extends GroovyPage {
if (value != null) {
modelEntry.taglibs.add(jspTagLibName)
}
return value
value
}

@Override
Expand All @@ -92,7 +92,7 @@ abstract class ModelRecordingGroovyPage extends GroovyPage {
modelEntry.model.put(property, valueClass.getName())
}
}
return value
value
}

}
Expand All @@ -112,17 +112,17 @@ class ModelRecordingCache {
}

private void initialize() {
System.err.println("Initialized model recording.")
System.err.println('Initialized model recording.')
ShutdownOperations.addOperation {
System.err.println("Writing model recordings to disk...")
System.err.println('Writing model recordings to disk...')
try {
close()
}
catch (e) {
e.printStackTrace(System.err)
}
finally {
System.err.println("Done.")
System.err.println('Done.')
}
}
}
Expand Down Expand Up @@ -182,7 +182,7 @@ class ModelEntry {
String getGspDeclaration() {
if (model || hasTagLibs()) {
def gspDeclaration = new StringBuilder()
gspDeclaration << "@{"
gspDeclaration << '@{'
if (model) {
gspDeclaration << " model='''\n"
model.each { String fieldName, String fieldType ->
Expand All @@ -208,10 +208,10 @@ class ModelEntry {
if (hasTagLibs()) {
gspDeclaration << " taglibs='${customTagLibs.join(', ')}' "
}
gspDeclaration << "}\n"
gspDeclaration << '}\n'
return gspDeclaration.toString()
}
return null
null
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2022 the original author or authors.
* Copyright 2004-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -82,7 +82,7 @@ class GroovyPageCompiler {
Map compile() {
if (srcFiles && targetDir && viewsDir) {
if (!generatedGroovyPagesDirectory) {
generatedGroovyPagesDirectory = new File(System.getProperty("java.io.tmpdir"), "gspcompile")
generatedGroovyPagesDirectory = new File(System.getProperty('java.io.tmpdir'), 'gspcompile')
generatedGroovyPagesDirectory.mkdirs()
}
if (configs) {
Expand Down Expand Up @@ -127,7 +127,7 @@ class GroovyPageCompiler {
throw ex
}
}
return results
results
} as Callable)
}

Expand All @@ -146,13 +146,13 @@ class GroovyPageCompiler {
}

// write the view registry to a properties file (this is read by GroovyPagesTemplateEngine at runtime)
File viewregistryFile = new File(targetDir, "gsp/views.properties")
File viewregistryFile = new File(targetDir, 'gsp/views.properties')
viewregistryFile.parentFile.mkdirs()
Properties views = new Properties()
if (viewregistryFile.exists()) {
// only changed files are added to the mapping, read the existing mapping file
viewregistryFile.withInputStream { stream ->
views.load(new InputStreamReader(stream, "UTF-8"))
views.load(new InputStreamReader(stream, 'UTF-8'))
}
}
views.putAll(compileGSPRegistry)
Expand All @@ -165,7 +165,7 @@ class GroovyPageCompiler {
threadPool.shutdown()
}
}
return compileGSPRegistry
compileGSPRegistry
}

/**
Expand All @@ -186,7 +186,7 @@ class GroovyPageCompiler {
String packageDir = "gsp/${packagePrefix}"
if (relPackagePath.length() > 0) {
if (!packageDir.endsWith('/')) {
packageDir += "/"
packageDir += '/'
}
packageDir += generateJavaName(relPackagePath)
}
Expand All @@ -207,7 +207,7 @@ class GroovyPageCompiler {

// compile check
if (gspfile.exists() && (!classFile.exists() || gspfile.lastModified() > classFile.lastModified())) {
File gspgroovyfile = new File(new File(generatedGroovyPagesDirectory, packageDir), className + ".groovy")
File gspgroovyfile = new File(new File(generatedGroovyPagesDirectory, packageDir), className + '.groovy')
// gspgroovyfile.getParentFile().mkdirs()

gspfile.withInputStream { InputStream gspinput ->
Expand Down Expand Up @@ -243,7 +243,7 @@ class GroovyPageCompiler {
compileGSPResults[viewuri] = fullClassName
}

return compileGSPResults
compileGSPResults
}

// find out the relative path from relbase to file
Expand Down

0 comments on commit d92f28f

Please sign in to comment.