mirror of https://github.com/jruby-gradle/jem
Start adding some code, basics to make codenarc/groovy/spock work together
This commit is contained in:
parent
dabb493f65
commit
019f0da204
|
@ -0,0 +1,44 @@
|
|||
apply plugin: 'groovy'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'codenarc'
|
||||
|
||||
version = '0.1'
|
||||
description = 'A Groovy-based library for managing Ruby gems'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.codehaus.groovy:groovy-all:2.4.0+"
|
||||
codenarc "org.codenarc:CodeNarc:0.24"
|
||||
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
|
||||
}
|
||||
|
||||
codenarc {
|
||||
sourceSets = [sourceSets.main]
|
||||
configFile = file("${projectDir}/gradle/codenarc.rules")
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging {
|
||||
showStandardStreams = true
|
||||
exceptionFormat "full"
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withType(JavaPlugin) {
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
|
||||
project.tasks.withType(JavaCompile) { task ->
|
||||
task.sourceCompatibility = project.sourceCompatibility
|
||||
task.targetCompatibility = project.targetCompatibility
|
||||
}
|
||||
|
||||
project.tasks.withType(GroovyCompile) { task ->
|
||||
task.sourceCompatibility = project.sourceCompatibility
|
||||
task.targetCompatibility = project.targetCompatibility
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
org.gradle.daemon=true
|
||||
targetCompatibility=1.7
|
||||
sourceCompatibility=1.7
|
|
@ -0,0 +1,359 @@
|
|||
ruleset {
|
||||
|
||||
description '''
|
||||
A Sample Groovy RuleSet containing all CodeNarc Rules
|
||||
You can use this as a template for your own custom RuleSet.
|
||||
Just delete the rules that you don't want to include.
|
||||
'''
|
||||
|
||||
AbcComplexity // DEPRECATED: Use the AbcMetric rule instead. Requires the GMetrics jar
|
||||
AbcMetric // Requires the GMetrics jar
|
||||
AbstractClassName
|
||||
AbstractClassWithPublicConstructor
|
||||
AbstractClassWithoutAbstractMethod
|
||||
AddEmptyString
|
||||
AssertWithinFinallyBlock
|
||||
AssignCollectionSort
|
||||
AssignCollectionUnique
|
||||
AssignmentInConditional
|
||||
AssignmentToStaticFieldFromInstanceMethod
|
||||
BigDecimalInstantiation
|
||||
BitwiseOperatorInConditional
|
||||
BlankLineBeforePackage
|
||||
BooleanGetBoolean
|
||||
BooleanMethodReturnsNull
|
||||
BracesForClass
|
||||
BracesForForLoop
|
||||
BracesForIfElse
|
||||
BracesForMethod
|
||||
BracesForTryCatchFinally
|
||||
BrokenNullCheck
|
||||
BrokenOddnessCheck
|
||||
BuilderMethodWithSideEffects
|
||||
BusyWait
|
||||
CatchArrayIndexOutOfBoundsException
|
||||
CatchError
|
||||
CatchException
|
||||
CatchIllegalMonitorStateException
|
||||
CatchIndexOutOfBoundsException
|
||||
CatchNullPointerException
|
||||
CatchRuntimeException
|
||||
CatchThrowable
|
||||
ChainedTest
|
||||
ClassForName
|
||||
ClassJavadoc
|
||||
ClassName
|
||||
ClassNameSameAsFilename
|
||||
ClassNameSameAsSuperclass
|
||||
ClassSize
|
||||
CloneWithoutCloneable
|
||||
CloneableWithoutClone
|
||||
CloseWithoutCloseable
|
||||
ClosureAsLastMethodParameter
|
||||
ClosureStatementOnOpeningLineOfMultipleLineClosure
|
||||
CollectAllIsDeprecated
|
||||
CompareToWithoutComparable
|
||||
ComparisonOfTwoConstants
|
||||
ComparisonWithSelf
|
||||
ConfusingClassNamedException
|
||||
ConfusingMethodName
|
||||
ConfusingMultipleReturns
|
||||
ConfusingTernary
|
||||
ConsecutiveBlankLines
|
||||
ConsecutiveLiteralAppends
|
||||
ConsecutiveStringConcatenation
|
||||
ConstantAssertExpression
|
||||
ConstantIfExpression
|
||||
ConstantTernaryExpression
|
||||
ConstantsOnlyInterface
|
||||
CouldBeElvis
|
||||
CoupledTestCase
|
||||
CrapMetric // Requires the GMetrics jar and a Cobertura coverage file
|
||||
CyclomaticComplexity // Requires the GMetrics jar
|
||||
DeadCode
|
||||
DirectConnectionManagement
|
||||
DoubleCheckedLocking
|
||||
DoubleNegative
|
||||
DuplicateCaseStatement
|
||||
DuplicateImport
|
||||
DuplicateListLiteral
|
||||
DuplicateMapKey
|
||||
DuplicateMapLiteral
|
||||
DuplicateNumberLiteral
|
||||
DuplicateSetValue
|
||||
DuplicateStringLiteral
|
||||
ElseBlockBraces
|
||||
EmptyCatchBlock
|
||||
EmptyClass
|
||||
EmptyElseBlock
|
||||
EmptyFinallyBlock
|
||||
EmptyForStatement
|
||||
EmptyIfStatement
|
||||
EmptyInstanceInitializer
|
||||
EmptyMethod
|
||||
EmptyMethodInAbstractClass
|
||||
EmptyStaticInitializer
|
||||
EmptySwitchStatement
|
||||
EmptySynchronizedStatement
|
||||
EmptyTryBlock
|
||||
EmptyWhileStatement
|
||||
EnumCustomSerializationIgnored
|
||||
EqualsAndHashCode
|
||||
EqualsOverloaded
|
||||
ExceptionExtendsError
|
||||
ExceptionExtendsThrowable
|
||||
ExceptionNotThrown
|
||||
ExplicitArrayListInstantiation
|
||||
ExplicitCallToAndMethod
|
||||
ExplicitCallToCompareToMethod
|
||||
ExplicitCallToDivMethod
|
||||
ExplicitCallToEqualsMethod
|
||||
ExplicitCallToGetAtMethod
|
||||
ExplicitCallToLeftShiftMethod
|
||||
ExplicitCallToMinusMethod
|
||||
ExplicitCallToModMethod
|
||||
ExplicitCallToMultiplyMethod
|
||||
ExplicitCallToOrMethod
|
||||
ExplicitCallToPlusMethod
|
||||
ExplicitCallToPowerMethod
|
||||
ExplicitCallToRightShiftMethod
|
||||
ExplicitCallToXorMethod
|
||||
ExplicitGarbageCollection
|
||||
ExplicitHashMapInstantiation
|
||||
ExplicitHashSetInstantiation
|
||||
ExplicitLinkedHashMapInstantiation
|
||||
ExplicitLinkedListInstantiation
|
||||
ExplicitStackInstantiation
|
||||
ExplicitTreeSetInstantiation
|
||||
FactoryMethodName
|
||||
FieldName
|
||||
FileCreateTempFile
|
||||
FileEndsWithoutNewline
|
||||
FinalClassWithProtectedMember
|
||||
ForLoopShouldBeWhileLoop
|
||||
ForStatementBraces
|
||||
GStringAsMapKey
|
||||
GStringExpressionWithinString
|
||||
GetterMethodCouldBeProperty
|
||||
GrailsDomainHasEquals
|
||||
GrailsDomainHasToString
|
||||
GrailsDomainReservedSqlKeywordName
|
||||
GrailsDomainWithServiceReference
|
||||
GrailsDuplicateConstraint
|
||||
GrailsDuplicateMapping
|
||||
GrailsMassAssignment
|
||||
GrailsPublicControllerMethod
|
||||
GrailsServletContextReference
|
||||
GrailsSessionReference // DEPRECATED
|
||||
GrailsStatelessService
|
||||
GroovyLangImmutable
|
||||
HardCodedWindowsFileSeparator
|
||||
HardCodedWindowsRootDirectory
|
||||
HashtableIsObsolete
|
||||
IfStatementBraces
|
||||
IfStatementCouldBeTernary
|
||||
IllegalClassMember
|
||||
IllegalClassReference
|
||||
IllegalPackageReference
|
||||
IllegalRegex
|
||||
IllegalString
|
||||
IllegalSubclass
|
||||
ImplementationAsType
|
||||
ImportFromSamePackage
|
||||
ImportFromSunPackages
|
||||
InconsistentPropertyLocking
|
||||
InconsistentPropertySynchronization
|
||||
InsecureRandom
|
||||
Instanceof
|
||||
IntegerGetInteger
|
||||
InterfaceName
|
||||
InterfaceNameSameAsSuperInterface
|
||||
InvertedIfElse
|
||||
JUnitAssertAlwaysFails
|
||||
JUnitAssertAlwaysSucceeds
|
||||
JUnitAssertEqualsConstantActualValue
|
||||
JUnitFailWithoutMessage
|
||||
JUnitLostTest
|
||||
JUnitPublicField
|
||||
JUnitPublicNonTestMethod
|
||||
JUnitPublicProperty
|
||||
JUnitSetUpCallsSuper
|
||||
JUnitStyleAssertions
|
||||
JUnitTearDownCallsSuper
|
||||
JUnitTestMethodWithoutAssert
|
||||
JUnitUnnecessarySetUp
|
||||
JUnitUnnecessaryTearDown
|
||||
JUnitUnnecessaryThrowsException
|
||||
JavaIoPackageAccess
|
||||
JdbcConnectionReference
|
||||
JdbcResultSetReference
|
||||
JdbcStatementReference
|
||||
LineLength
|
||||
LocaleSetDefault
|
||||
LoggerForDifferentClass
|
||||
LoggerWithWrongModifiers
|
||||
LoggingSwallowsStacktrace
|
||||
LongLiteralWithLowerCaseL
|
||||
MethodCount
|
||||
MethodName
|
||||
MethodSize
|
||||
MisorderedStaticImports
|
||||
MissingBlankLineAfterImports
|
||||
MissingBlankLineAfterPackage
|
||||
MissingNewInThrowStatement
|
||||
MultipleLoggers
|
||||
MultipleUnaryOperators
|
||||
NestedBlockDepth
|
||||
NestedForLoop
|
||||
NestedSynchronization
|
||||
NoDef
|
||||
NoWildcardImports
|
||||
NonFinalPublicField
|
||||
NonFinalSubclassOfSensitiveInterface
|
||||
ObjectFinalize
|
||||
ObjectOverrideMisspelledMethodName
|
||||
PackageName
|
||||
PackageNameMatchesFilePath
|
||||
ParameterCount
|
||||
ParameterName
|
||||
ParameterReassignment
|
||||
PrintStackTrace
|
||||
Println
|
||||
PrivateFieldCouldBeFinal
|
||||
PropertyName
|
||||
PublicFinalizeMethod
|
||||
PublicInstanceField
|
||||
RandomDoubleCoercedToZero
|
||||
RemoveAllOnSelf
|
||||
RequiredRegex
|
||||
RequiredString
|
||||
ReturnFromFinallyBlock
|
||||
ReturnNullFromCatchBlock
|
||||
ReturnsNullInsteadOfEmptyArray
|
||||
ReturnsNullInsteadOfEmptyCollection
|
||||
SerialPersistentFields
|
||||
SerialVersionUID
|
||||
/* Not needed
|
||||
SerializableClassMustDefineSerialVersionUID
|
||||
*/
|
||||
SimpleDateFormatMissingLocale
|
||||
SpaceAfterCatch
|
||||
SpaceAfterClosingBrace
|
||||
SpaceAfterComma
|
||||
SpaceAfterFor
|
||||
SpaceAfterIf
|
||||
SpaceAfterOpeningBrace
|
||||
SpaceAfterSemicolon
|
||||
SpaceAfterSwitch
|
||||
SpaceAfterWhile
|
||||
SpaceAroundClosureArrow
|
||||
SpaceAroundMapEntryColon
|
||||
SpaceAroundOperator
|
||||
SpaceBeforeClosingBrace
|
||||
SpaceBeforeOpeningBrace
|
||||
SpockIgnoreRestUsed
|
||||
StatelessClass
|
||||
StatelessSingleton
|
||||
StaticCalendarField
|
||||
StaticConnection
|
||||
StaticDateFormatField
|
||||
StaticMatcherField
|
||||
StaticSimpleDateFormatField
|
||||
SwallowThreadDeath
|
||||
SynchronizedMethod
|
||||
SynchronizedOnBoxedPrimitive
|
||||
SynchronizedOnGetClass
|
||||
SynchronizedOnReentrantLock
|
||||
SynchronizedOnString
|
||||
SynchronizedOnThis
|
||||
SynchronizedReadObjectMethod
|
||||
SystemErrPrint
|
||||
SystemExit
|
||||
SystemOutPrint
|
||||
SystemRunFinalizersOnExit
|
||||
TernaryCouldBeElvis
|
||||
ThisReferenceEscapesConstructor
|
||||
ThreadGroup
|
||||
ThreadLocalNotStaticFinal
|
||||
ThreadYield
|
||||
ThrowError
|
||||
ThrowException
|
||||
ThrowExceptionFromFinallyBlock
|
||||
ThrowNullPointerException
|
||||
ThrowRuntimeException
|
||||
ThrowThrowable
|
||||
ToStringReturnsNull
|
||||
TrailingWhitespace
|
||||
UnnecessaryBigDecimalInstantiation
|
||||
UnnecessaryBigIntegerInstantiation
|
||||
UnnecessaryBooleanExpression
|
||||
UnnecessaryBooleanInstantiation
|
||||
UnnecessaryCallForLastElement
|
||||
UnnecessaryCallToSubstring
|
||||
UnnecessaryCast
|
||||
UnnecessaryCatchBlock
|
||||
UnnecessaryCollectCall
|
||||
UnnecessaryCollectionCall
|
||||
UnnecessaryConstructor
|
||||
UnnecessaryDefInFieldDeclaration
|
||||
UnnecessaryDefInMethodDeclaration
|
||||
UnnecessaryDefInVariableDeclaration
|
||||
UnnecessaryDotClass
|
||||
UnnecessaryDoubleInstantiation
|
||||
UnnecessaryElseStatement
|
||||
UnnecessaryFail
|
||||
UnnecessaryFinalOnPrivateMethod
|
||||
UnnecessaryFloatInstantiation
|
||||
UnnecessaryGString
|
||||
UnnecessaryGetter
|
||||
UnnecessaryGroovyImport
|
||||
UnnecessaryIfStatement
|
||||
UnnecessaryInstanceOfCheck
|
||||
UnnecessaryInstantiationToGetClass
|
||||
UnnecessaryIntegerInstantiation
|
||||
UnnecessaryLongInstantiation
|
||||
UnnecessaryModOne
|
||||
UnnecessaryNullCheck
|
||||
UnnecessaryNullCheckBeforeInstanceOf
|
||||
UnnecessaryObjectReferences
|
||||
UnnecessaryOverridingMethod
|
||||
UnnecessaryPackageReference
|
||||
UnnecessaryParenthesesForMethodCallWithClosure
|
||||
UnnecessaryPublicModifier
|
||||
UnnecessaryReturnKeyword
|
||||
UnnecessarySafeNavigationOperator
|
||||
UnnecessarySelfAssignment
|
||||
UnnecessarySemicolon
|
||||
UnnecessaryStringInstantiation
|
||||
UnnecessarySubstring
|
||||
UnnecessaryTernaryExpression
|
||||
UnnecessaryToString
|
||||
UnnecessaryTransientModifier
|
||||
UnsafeArrayDeclaration
|
||||
UnsafeImplementationAsMap
|
||||
UnusedArray
|
||||
UnusedImport
|
||||
UnusedMethodParameter
|
||||
UnusedObject
|
||||
UnusedPrivateField
|
||||
UnusedPrivateMethod
|
||||
UnusedPrivateMethodParameter
|
||||
UnusedVariable
|
||||
UseAssertEqualsInsteadOfAssertTrue
|
||||
UseAssertFalseInsteadOfNegation
|
||||
UseAssertNullInsteadOfAssertEquals
|
||||
UseAssertSameInsteadOfAssertTrue
|
||||
UseAssertTrueInsteadOfAssertEquals
|
||||
UseAssertTrueInsteadOfNegation
|
||||
UseCollectMany
|
||||
UseCollectNested
|
||||
UseOfNotifyMethod
|
||||
VariableName
|
||||
VectorIsObsolete
|
||||
VolatileArrayField
|
||||
VolatileLongOrDoubleField
|
||||
WaitOutsideOfWhileLoop
|
||||
WhileStatementBraces
|
||||
}
|
||||
|
||||
// vim: ft=groovy
|
|
@ -0,0 +1,9 @@
|
|||
package com.github.jrubygradle.groovygem
|
||||
|
||||
/**
|
||||
* Plain Old Groovy Object wrapping the data for a Gem
|
||||
*/
|
||||
class Gem {
|
||||
String name
|
||||
String version
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.github.jrubygradle.groovygem
|
||||
|
||||
import spock.lang.*
|
||||
|
||||
class GemSpec extends Specification {
|
||||
}
|
Loading…
Reference in New Issue