org.codenarc.rule
Interface Rule

All Known Implementing Classes:
AbcComplexityRule, AbstractAstVisitorRule, AbstractClassNameRule, AbstractClassWithoutAbstractMethodRule, AbstractClassWithPublicConstructorRule, AbstractImportRule, AbstractRule, AbstractSharedAstVisitorRule, AddEmptyStringRule, AssertWithinFinallyBlockRule, AssignCollectionSortRule, AssignCollectionUniqueRule, AssignmentInConditionalRule, BigDecimalInstantiationRule, BitwiseOperatorInConditionalRule, BooleanGetBooleanRule, BooleanMethodReturnsNullRule, BracesForClassRule, BracesForForLoopRule, BracesForIfElseRule, BracesForMethodRule, BracesForTryCatchFinallyRule, BrokenNullCheckRule, BrokenOddnessCheckRule, BuilderMethodWithSideEffectsRule, BusyWaitRule, CatchArrayIndexOutOfBoundsExceptionRule, CatchErrorRule, CatchExceptionRule, CatchIllegalMonitorStateExceptionRule, CatchIndexOutOfBoundsExceptionRule, CatchNullPointerExceptionRule, CatchRuntimeExceptionRule, CatchThrowableRule, ChainedTestRule, ClassForNameRule, ClassJavadocRule, ClassNameRule, ClassSizeRule, CloneableWithoutCloneRule, CloseWithoutCloseableRule, ClosureAsLastMethodParameterRule, CollectAllIsDeprecatedRule, CompareToWithoutComparableRule, ComparisonOfTwoConstantsRule, ComparisonWithSelfRule, ConfusingClassNamedExceptionRule, ConfusingMethodNameRule, ConfusingMultipleReturnsRule, ConfusingTernaryRule, ConsecutiveLiteralAppendsRule, ConsecutiveStringConcatenationRule, ConstantAssertExpressionRule, ConstantIfExpressionRule, ConstantsOnlyInterfaceRule, ConstantTernaryExpressionRule, CouldBeElvisRule, CoupledTestCaseRule, CrapMetricRule, CyclomaticComplexityRule, DeadCodeRule, DirectConnectionManagementRule, DoubleCheckedLockingRule, DoubleNegativeRule, DuplicateCaseStatementRule, DuplicateImportRule, DuplicateListLiteralRule, DuplicateMapKeyRule, DuplicateMapLiteralRule, DuplicateNumberLiteralRule, DuplicateSetValueRule, DuplicateStringLiteralRule, ElseBlockBracesRule, EmptyCatchBlockRule, EmptyElseBlockRule, EmptyFinallyBlockRule, EmptyForStatementRule, EmptyIfStatementRule, EmptyInstanceInitializerRule, EmptyMethodInAbstractClassRule, EmptyMethodRule, EmptyStaticInitializerRule, EmptySwitchStatementRule, EmptySynchronizedStatementRule, EmptyTryBlockRule, EmptyWhileStatementRule, EqualsAndHashCodeRule, EqualsOverloadedRule, ExceptionExtendsErrorRule, ExplicitArrayListInstantiationRule, ExplicitCallToAndMethodRule, ExplicitCallToCompareToMethodRule, ExplicitCallToDivMethodRule, ExplicitCallToEqualsMethodRule, ExplicitCallToGetAtMethodRule, ExplicitCallToLeftShiftMethodRule, ExplicitCallToMinusMethodRule, ExplicitCallToModMethodRule, ExplicitCallToMultiplyMethodRule, ExplicitCallToOrMethodRule, ExplicitCallToPlusMethodRule, ExplicitCallToPowerMethodRule, ExplicitCallToRightShiftMethodRule, ExplicitCallToXorMethodRule, ExplicitGarbageCollectionRule, ExplicitHashMapInstantiationRule, ExplicitHashSetInstantiationRule, ExplicitLinkedHashMapInstantiationRule, ExplicitLinkedListInstantiationRule, ExplicitStackInstantiationRule, ExplicitTreeSetInstantiationRule, FactoryMethodNameRule, FieldNameRule, FileCreateTempFileRule, FinalClassWithProtectedMemberRule, ForLoopShouldBeWhileLoopRule, ForStatementBracesRule, GetterMethodCouldBePropertyRule, GrailsDomainHasEqualsRule, GrailsDomainHasToStringRule, GrailsPublicControllerMethodRule, GrailsServletContextReferenceRule, GrailsSessionReferenceRule, GrailsStatelessServiceRule, GroovyLangImmutableRule, GStringAsMapKeyRule, HardCodedWindowsFileSeparatorRule, HardCodedWindowsRootDirectoryRule, HashtableIsObsoleteRule, IfStatementBracesRule, IllegalClassReferenceRule, IllegalPackageReferenceRule, IllegalRegexRule, ImplementationAsTypeRule, ImportFromSamePackageRule, ImportFromSunPackagesRule, InconsistentPropertyLockingRule, InconsistentPropertySynchronizationRule, InsecureRandomRule, IntegerGetIntegerRule, InterfaceNameRule, InvertedIfElseRule, JavaIoPackageAccessRule, JdbcConnectionReferenceRule, JdbcResultSetReferenceRule, JdbcStatementReferenceRule, JUnitAssertAlwaysFailsRule, JUnitAssertAlwaysSucceedsRule, JUnitFailWithoutMessageRule, JUnitPublicNonTestMethodRule, JUnitSetUpCallsSuperRule, JUnitStyleAssertionsRule, JUnitTearDownCallsSuperRule, JUnitTestMethodWithoutAssertRule, JUnitUnnecessarySetUpRule, JUnitUnnecessaryTearDownRule, LineLengthRule, LoggerForDifferentClassRule, LoggerWithWrongModifiersRule, LoggingSwallowsStacktraceRule, LongLiteralWithLowerCaseLRule, MethodCountRule, MethodNameRule, MethodSizeRule, MisorderedStaticImportsRule, MissingNewInThrowStatementRule, MultipleLoggersRule, NestedBlockDepthRule, NestedSynchronizationRule, NonFinalPublicFieldRule, NonFinalSubclassOfSensitiveInterfaceRule, ObjectFinalizeRule, ObjectOverrideMisspelledMethodNameRule, PackageNameRule, ParameterNameRule, ParameterReassignmentRule, PrintlnRule, PrintStackTraceRule, PrivateFieldCouldBeFinalRule, PropertyNameRule, PublicFinalizeMethodRule, PublicInstanceFieldRule, RandomDoubleCoercedToZeroRule, RemoveAllOnSelfRule, RequiredRegexRule, RequiredStringRule, ReturnFromFinallyBlockRule, ReturnNullFromCatchBlockRule, ReturnsNullInsteadOfEmptyArrayRule, ReturnsNullInsteadOfEmptyCollectionRule, SerializableClassMustDefineSerialVersionUIDRule, SerialPersistentFieldsRule, SerialVersionUIDRule, SimpleDateFormatMissingLocaleRule, SpockIgnoreRestUsedRule, StatelessClassRule, StatelessSingletonRule, StaticCalendarFieldRule, StaticConnectionRule, StaticDateFormatFieldRule, StaticMatcherFieldRule, StaticSimpleDateFormatFieldRule, SwallowThreadDeathRule, SynchronizedMethodRule, SynchronizedOnBoxedPrimitiveRule, SynchronizedOnGetClassRule, SynchronizedOnReentrantLockRule, SynchronizedOnStringRule, SynchronizedOnThisRule, SynchronizedReadObjectMethodRule, SystemErrPrintRule, SystemExitRule, SystemOutPrintRule, SystemRunFinalizersOnExitRule, TernaryCouldBeElvisRule, ThreadGroupRule, ThreadLocalNotStaticFinalRule, ThreadYieldRule, ThrowErrorRule, ThrowExceptionFromFinallyBlockRule, ThrowExceptionRule, ThrowNullPointerExceptionRule, ThrowRuntimeExceptionRule, ThrowThrowableRule, UnnecessaryBigDecimalInstantiationRule, UnnecessaryBigIntegerInstantiationRule, UnnecessaryBooleanExpressionRule, UnnecessaryBooleanInstantiationRule, UnnecessaryCallForLastElementRule, UnnecessaryCallToSubstringRule, UnnecessaryCatchBlockRule, UnnecessaryCollectCallRule, UnnecessaryCollectionCallRule, UnnecessaryConstructorRule, UnnecessaryDefInFieldDeclarationRule, UnnecessaryDefInMethodDeclarationRule, UnnecessaryDefInVariableDeclarationRule, UnnecessaryDotClassRule, UnnecessaryDoubleInstantiationRule, UnnecessaryElseStatementRule, UnnecessaryFailRule, UnnecessaryFinalOnPrivateMethodRule, UnnecessaryFloatInstantiationRule, UnnecessaryGetterRule, UnnecessaryGroovyImportRule, UnnecessaryGStringRule, UnnecessaryIfStatementRule, UnnecessaryInstanceOfCheckRule, UnnecessaryInstantiationToGetClassRule, UnnecessaryIntegerInstantiationRule, UnnecessaryLongInstantiationRule, UnnecessaryModOneRule, UnnecessaryNullCheckBeforeInstanceOfRule, UnnecessaryNullCheckRule, UnnecessaryObjectReferencesRule, UnnecessaryOverridingMethodRule, UnnecessaryPackageReferenceRule, UnnecessaryParenthesesForMethodCallWithClosureRule, UnnecessaryPublicModifierRule, UnnecessaryReturnKeywordRule, UnnecessarySelfAssignmentRule, UnnecessarySemicolonRule, UnnecessaryStringInstantiationRule, UnnecessarySubstringRule, UnnecessaryTernaryExpressionRule, UnnecessaryTransientModifierRule, UnsafeArrayDeclarationRule, UnusedArrayRule, UnusedImportRule, UnusedMethodParameterRule, UnusedObjectRule, UnusedPrivateFieldRule, UnusedPrivateMethodParameterRule, UnusedPrivateMethodRule, UnusedVariableRule, UseAssertEqualsInsteadOfAssertTrueRule, UseAssertFalseInsteadOfNegationRule, UseAssertNullInsteadOfAssertEqualsRule, UseAssertSameInsteadOfAssertTrueRule, UseAssertTrueInsteadOfAssertEqualsRule, UseAssertTrueInsteadOfNegationRule, UseCollectManyRule, UseCollectNestedRule, UseOfNotifyMethodRule, VariableNameRule, VectorIsObsoleteRule, VolatileArrayFieldRule, VolatileLongOrDoubleFieldRule, WaitOutsideOfWhileLoopRule, WhileStatementBracesRule

public interface Rule

Represents a source code analysis rule .

Author:
Chris Mair

Method Summary
 List<Violation> applyTo(SourceCode sourceCode)
          Apply this rule to the specified source and return a list of violations (or an empty List)
 String getName()
           
 int getPriority()
           
 

Method Detail

applyTo

List<Violation> applyTo(SourceCode sourceCode)
                        throws Throwable
Apply this rule to the specified source and return a list of violations (or an empty List)

Parameters:
sourceCode - - the source to apply this rule to
Returns:
the List of violations; may be empty
Throws:
Throwable - could throw anything

getPriority

int getPriority()
Returns:
the priority of this rule; must be 1, 2 or 3

getName

String getName()
Returns:
the unique id for this rule


Copyright © 2012. All Rights Reserved.