Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
codenarc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
snimavat committed May 7, 2019
1 parent 5b65423 commit 31110b7
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 68 deletions.
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ bootRun {
bootRepackage.enabled = false

ext.codenarcRuleset= '''
getRule('LineLength').enabled = false
getRule('CyclomaticComplexity').enabled = false
getRule('NoWildcardImports').enabled = false
getRule('UnnecessaryDotClass').enabled = false
getRule('CatchException').enabled = false
getRule('AbcMetric').enabled = false
getRule('MethodSize').enabled = false
getRule('InvertedIfElse').enabled = false
//getRule('Println').enabled = false
'''


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class DynamicReportsService {
colb.setHyperLink(link)

if (fld.isBooleanType()) {
jrb.addField(field, Boolean.class) //drb.field(field,Boolean.class)
jrb.addField(field, Boolean) //drb.field(field,Boolean.class)

//? (char)0x2611 : (char)0x2610") //<- see http://dejavu.sourceforge.net/samples/DejaVuSans.pdf for more options
JasperExpression bool = jrExp('$F{' + field + '} ? (char)0x2713 : ""')
Expand Down Expand Up @@ -200,7 +200,7 @@ class DynamicReportsService {
//just add it to the first one
//sbtList[0].setLabel("${fieldMetaMap[field].title} Totals").setLabelPosition(Position.LEFT);

JasperExpression<String> label = jrExp("\$F{" + field + "} + \" Total\"", String.class)
JasperExpression<String> label = jrExp("\$F{" + field + "} + \" Total\"", String)
//sbtList.add drb.sbt.first(label,fieldMetaMap[config.groupTotalLabels].builder)
group.setFooterBackgroundComponent(
Components.text(label).setStyle(TemplateStyles.subtotal)
Expand Down
6 changes: 5 additions & 1 deletion plugin/src/main/groovy/nine/jasper/JasperUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import net.sf.jasperreports.engine.export.HtmlExporter
import net.sf.jasperreports.engine.export.JRPdfExporter
import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter
import net.sf.jasperreports.engine.util.JRLoader
import net.sf.jasperreports.export.*
import net.sf.jasperreports.export.Exporter
import net.sf.jasperreports.export.SimpleExporterInput
import net.sf.jasperreports.export.SimpleHtmlExporterConfiguration
import net.sf.jasperreports.export.SimpleHtmlExporterOutput
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput
import nine.reports.ReportFormat
import org.springframework.context.ApplicationContextException
import org.springframework.core.io.FileSystemResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ package nine.jasper.spring

import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import net.sf.jasperreports.engine.*
import net.sf.jasperreports.engine.JRDataSource
import net.sf.jasperreports.engine.JRException
import net.sf.jasperreports.engine.JRParameter
import net.sf.jasperreports.engine.JasperFillManager
import net.sf.jasperreports.engine.JasperPrint
import net.sf.jasperreports.engine.JasperReport
import nine.jasper.JRDataSourceJDBC
import nine.jasper.JasperUtils
import org.springframework.context.ApplicationContextException
Expand Down Expand Up @@ -445,7 +450,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
* @return the value types in prioritized order
*/
protected Class<?>[] getReportDataTypes() {
return [Collection.class, ([] as Object[]).class] as Class<?>[]
return [Collection, ([] as Object[]).class] as Class<?>[]
}

/**
Expand Down
6 changes: 3 additions & 3 deletions plugin/src/main/groovy/nine/jasper/spring/JasperView.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package nine.jasper.spring

import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode
import groovy.util.logging.Slf4j
import net.sf.jasperreports.engine.JRParameter
import nine.reports.ReportFormat
import net.sf.jasperreports.engine.JRAbstractExporter
import net.sf.jasperreports.engine.JRParameter
import net.sf.jasperreports.engine.JasperPrint
import net.sf.jasperreports.export.Exporter
import net.sf.jasperreports.export.WriterExporterOutput
import nine.jasper.JasperUtils
import nine.reports.ReportFormat
import org.springframework.web.util.WebUtils

import javax.servlet.ServletOutputStream
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

/**
* JasperReports view class that allows for the actual rendering format
* to be specified at runtime using a parameter contained in the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class JasperViewResolver extends LoaderUrlBasedViewResolver {
*/
@Override
protected Class<?> requiredViewClass() {
return AbstractJasperReportsView.class
return AbstractJasperReportsView
}

@Override
Expand Down
7 changes: 4 additions & 3 deletions plugin/src/main/groovy/nine/reports/DomainMetaUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,17 @@ class DomainMetaUtils {
*/
@CompileDynamic
static Closure orderNested(String propertyName, String direction) {
if (!propertyName.contains('.')) {
return { order(propertyName, direction) }
} else {
if (propertyName.contains('.')) {
def props = propertyName.split(/\./) as List
def last = props.pop()
Closure toDo = { order(last, direction) }
Closure newOrderBy = props.reverse().inject(toDo) { acc, prop ->
{ -> "$prop"(acc) }
}
return newOrderBy
} else {
return { order(propertyName, direction) }

}
}

Expand Down
6 changes: 5 additions & 1 deletion plugin/src/main/groovy/nine/reports/FieldMetadata.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package nine.reports

import groovy.transform.CompileStatic

/**
* Stores basic information about a Field (property or column)
*/

@CompileStatic
class FieldMetadata implements Serializable {

public FieldMetadata() {}
Expand Down Expand Up @@ -66,7 +70,7 @@ class FieldMetadata implements Serializable {
Object builder

Boolean isBooleanType() {
if (typeClass == java.lang.Boolean || typeClassName == 'java.lang.Boolean') {
if (typeClass == Boolean || typeClassName == 'java.lang.Boolean') {
return true
}
}
Expand Down
3 changes: 2 additions & 1 deletion plugin/src/main/groovy/nine/reports/ReportFormat.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ enum ReportFormat {
/**
* valueOf using toString.toUpperCase() of passed object
*/
public static ReportFormat get(nm) {
@SuppressWarnings(['ReturnNullFromCatchBlock'])
public static ReportFormat get(Object nm) {
try {
return valueOf(nm.toString().toUpperCase())
} catch (IllegalArgumentException e) {
Expand Down
10 changes: 0 additions & 10 deletions travis-build.sh

This file was deleted.

22 changes: 0 additions & 22 deletions travis-publish.sh

This file was deleted.

0 comments on commit 31110b7

Please sign in to comment.