Add basic groovy code style validation.
IDK how well this would work on a gradle script but might be interesting to try on yarn or something.dev/0.11
parent
759cac2e6b
commit
ff6701e817
|
@ -20,3 +20,4 @@
|
|||
!/settings.gradle
|
||||
!/Jenkinsfile
|
||||
!/checkstyle.xml
|
||||
!/codenarc.groovy
|
|
@ -7,6 +7,7 @@ plugins {
|
|||
id 'groovy'
|
||||
id 'checkstyle'
|
||||
id 'jacoco'
|
||||
id 'codenarc'
|
||||
id "org.cadixdev.licenser" version "0.5.0"
|
||||
}
|
||||
|
||||
|
@ -110,6 +111,11 @@ checkstyle {
|
|||
toolVersion = '8.39'
|
||||
}
|
||||
|
||||
codenarc {
|
||||
toolVersion = "2.0.0"
|
||||
configFile = file("codenarc.groovy")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
fabricLoom {
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
ruleset {
|
||||
UnnecessarySemicolon
|
||||
BlockEndsWithBlankLine
|
||||
BlockStartsWithBlankLine
|
||||
ConsecutiveBlankLines
|
||||
MissingBlankLineAfterImports
|
||||
MissingBlankLineAfterPackage
|
||||
|
||||
// Braces
|
||||
BracesForClass
|
||||
BracesForForLoop
|
||||
BracesForIfElse
|
||||
BracesForMethod
|
||||
BracesForTryCatchFinally
|
||||
|
||||
// Spaces
|
||||
SpaceAfterCatch
|
||||
SpaceAfterComma
|
||||
SpaceAfterClosingBrace
|
||||
SpaceAfterFor
|
||||
SpaceAfterIf
|
||||
SpaceAfterOpeningBrace
|
||||
SpaceAfterSemicolon
|
||||
SpaceAfterSwitch
|
||||
SpaceAfterWhile
|
||||
SpaceAroundClosureArrow
|
||||
SpaceAroundMapEntryColon
|
||||
SpaceAroundOperator
|
||||
SpaceBeforeClosingBrace
|
||||
SpaceBeforeOpeningBrace
|
||||
TrailingWhitespace
|
||||
|
||||
// Groovyism - See: https://codenarc.org/codenarc-rules-groovyism.html
|
||||
ClosureAsLastMethodParameter
|
||||
ExplicitArrayListInstantiation
|
||||
ExplicitCallToAndMethod
|
||||
ExplicitCallToCompareToMethod
|
||||
ExplicitCallToDivMethod
|
||||
ExplicitCallToEqualsMethod
|
||||
ExplicitCallToGetAtMethod
|
||||
ExplicitCallToLeftShiftMethod
|
||||
ExplicitCallToMinusMethod
|
||||
ExplicitCallToMultiplyMethod
|
||||
ExplicitCallToModMethod
|
||||
ExplicitCallToOrMethod
|
||||
ExplicitCallToPlusMethod
|
||||
ExplicitCallToPowerMethod
|
||||
ExplicitCallToRightShiftMethod
|
||||
ExplicitCallToXorMethod
|
||||
ExplicitHashMapInstantiation
|
||||
ExplicitLinkedHashMapInstantiation
|
||||
ExplicitHashSetInstantiation
|
||||
ExplicitLinkedListInstantiation
|
||||
ExplicitStackInstantiation
|
||||
ExplicitTreeSetInstantiation
|
||||
GetterMethodCouldBeProperty
|
||||
GStringAsMapKey
|
||||
GStringExpressionWithinString
|
||||
CouldBeElvis
|
||||
TernaryCouldBeElvis
|
||||
FieldTypeRequired
|
||||
MethodParameterTypeRequired
|
||||
|
||||
//Misc
|
||||
LongLiteralWithLowerCaseL
|
||||
}
|
Loading…
Reference in New Issue