Sample Groovy Project by mrhaki

Generated
Jan 10, 2011 2:05:22 PM
Tool
CodeNarc
Version
0.11
Sources
src/main/groovy

Files

NameViolations
com/mrhaki/app/PersonService.groovy4
com/mrhaki/app/App.groovy3
com/mrhaki/app/Person.groovy1

File App.groovy

PriorityRuleViolation DescriptionLineSource
1Println6println 'Ready for running the App'
1Println10println "Found 'mrhaki': ${PersonService.findByNickname('mrhaki')}"
2VariableName8def PersonService = new PersonService()
Back to top

File Person.groovy

PriorityRuleViolation DescriptionLineSource
2PropertyName4String NAME
Back to top

File PersonService.groovy

PriorityRuleViolation DescriptionLineSource
2GStringAsMapKeyGString as a key in a map is unsafe8 new Person(NAME: 'Hubert Klein Ikkink', "${keyNickname}": 'mrhaki', country: 'The Netherlands')
2GStringAsMapKeyGString as a key in a map is unsafe8 new Person(NAME: 'Hubert Klein Ikkink', "${keyNickname}": 'mrhaki', country: 'The Netherlands')
2ParameterName12return persons.find { P -> nickname == P.nickname }
3UnnecessaryReturnKeyword12return persons.find { P -> nickname == P.nickname }
Back to top

Rules

NameDescriptionViolations
GStringAsMapKey A GString should not be used as a map key since its hashcode is not guaranteed to be stable. Consider calling key.toString().2
ParameterName Verifies that the name of each parameter matches a regular expression. This rule applies to method parameters, constructor parameters and closure parameters. By default it checks that parameter names start with a lowercase letter and contains only letters or numbers. The regex property specifies the default regular expression used to validate the parameter name. The ignoreParameterNames property can specify parameter names that should be ignored, optionally containing wildcard characters ('*' or '?').1
PrintlnChecks for calls to this.print(), this.println() or this.printf().2
PropertyName Verifies that the name of each property matches a regular expression. By default it checks that property names other than 'static final' start with a lowercase letter and contains only letters or numbers, and 'static final' property names start with an uppercase letter and contain only uppercase letters, numbers and underscores. The regex property specifies the default regular expression used to validate property names. The finalRegex property specifies the regular expression to validate 'final' property names. The staticRegex property specifies the regular expression to validate 'static' property names. The staticFinalRegex property specifies the regular expression to validate 'static final' property names. The ignorePropertyNames property can specify property names that should be ignored, optionally containing wildcard characters ('*' or '?').1
UnnecessaryReturnKeyword In Groovy, the return keyword is often optional. If a statement is the last line in a method or closure then you do not need to have the return keyword.1
VariableName Verifies that the name of each method matches a regular expression. By default it checks that non-'final' variable names start with a lowercase letter and contains only letters or numbers, and 'final' variable names start with an uppercase letter and contain only uppercase letters, numbers and underscores. The regex property specifies the default regular expression used to validate a non-'final' variable name. The finalRegex property specifies the regular expression used to validate 'final' variable names. The ignoreVariableNames property can specify variable names that should be ignored, optionally containing wildcard characters ('*' or '?').1

XSLT created by Hubert A. Klein Ikkink (mrhaki)