Static Code Analysis Default Configuration
The following sections list the rules that are active for the default static code analysis configuration.
Java
Spotbugs
All tool categories and their rules are active by default except for the NOISE and EXPERIMENTAL category. Refer to the Spotbugs documentation for a description of all rules.
Checkstyle
This table contains all rules that are activated by default when creating a new programming exercise. You can suppress a complete category by changing its visibility in the grading settings. For a more fine-granular configuration, you can add or remove rules by editing the checkstyle-configuration.xml file. For a description of the rules refer to the Checkstyle documentation.
| Category (Tool/Artemis) | Rule | Properties |
|---|---|---|
| Coding / Code Style | EmptyStatement | |
| EqualsHashCode | ||
| HiddenField | ignoreConstructorParameter="true" | |
| ignoreSetter="true" | ||
| setterCanReturnItsClass="true" | ||
| IllegalInstantiation | ||
| InnerAssignment | ||
| MagicNumber | ||
| MissingSwitchDefault | ||
| MultipleVariableDeclarations | ||
| SimplifyBooleanExpression | ||
| SimplifyBooleanReturn | ||
| Class Design / Design | FinalClass | |
| HideUtilityClassConstructor | ||
| InterfaceIsType | ||
| VisibilityModifier | ||
| Block Checks / Code Style | AvoidNestedBlocks | |
| EmptyBlock | ||
| NeedBraces | ||
| Modifiers / Code Style | ModifierOrder | |
| RedundantModifier | ||
| Size Violations / Code Metrics | MethodLength | |
| ParameterNumber | ||
| FileLength | ||
| LineLength | max="120" | |
| Imports / Naming & Formatting | IllegalImport | |
| RedundantImport | ||
| UnusedImports | processJavadoc="false" | |
| Naming Conventions / Naming & Formatting | ConstantName | |
| LocalFinalVariableName | ||
| LocalVariableName | ||
| MemberName | ||
| MethodName | ||
| ParameterName | ||
| StaticVariableName | ||
| TypeName | ||
| Whitespace / Naming & Formatting | EmptyForIteratorPad | |
| GenericWhitespace | ||
| MethodParamPad | ||
| NoWhitespaceAfter | ||
| NoWhitespaceBefore | ||
| OperatorWrap | ||
| ParenPad | ||
| TypecastParenPad | ||
| WhitespaceAfter | ||
| WhitespaceAround | ||
| Javadoc Comments / Documentation | InvalidJavadocPosition | |
| JavadocMethod | ||
| JavadocType | ||
| JavadocStyle | ||
| MissingJavadocMethod | allowMissingPropertyJavadoc="true" | |
| allowedAnnotations="Override,Test" | ||
| tokens="METHOD_DEF,ANNOTATION_FIELD_DEF,COMPACT_CTOR_DEF" | ||
| Miscellaneous / Miscellaneous | ArrayTypeStyle | |
| RegexpSingleline | flags trailing whitespace | |
| UpperEll | ||
| NewlineAtEndOfFile | ||
| Translation |
PMD
For a description of the rules refer to the PMD documentation.
| Category (Tool/Artemis) | Rule |
|---|---|
| Best Practices / Bad Practice | AvoidUsingHardCodedIP |
| CheckResultSet | |
| UnusedFormalParameter | |
| UnusedLocalVariable | |
| UnusedPrivateField | |
| UnusedPrivateMethod | |
| PrimitiveWrapperInstantiation | |
| Code Style / Code Style | UnnecessaryImport |
| ExtendsObject | |
| ForLoopShouldBeWhileLoop | |
| TooManyStaticImports | |
| UnnecessaryFullyQualifiedName | |
| UnnecessaryModifier | |
| UnnecessaryReturn | |
| UselessParentheses | |
| UselessQualifiedThis | |
| EmptyControlStatement | |
| Documentation / Documentation | all rules of the category |
| Design / Design | CollapsibleIfStatements |
| SimplifiedTernary | |
| UselessOverridingMethod | |
| Error Prone / Potential Bugs | AvoidBranchingStatementAsLastInLoop |
| AvoidDecimalLiteralsInBigDecimalConstructor | |
| AvoidMultipleUnaryOperators | |
| AvoidUsingOctalValues | |
| BrokenNullCheck | |
| CheckSkipResult | |
| ClassCastExceptionWithToArray | |
| DontUseFloatTypeForLoopIndices | |
| JumbledIncrementer | |
| MisplacedNullCheck | |
| OverrideBothEqualsAndHashcode | |
| ReturnFromFinallyBlock | |
| UnconditionalIfStatement | |
| UnnecessaryConversionTemporary | |
| UnusedNullCheckInEquals | |
| UselessOperationOnImmutable | |
| Multithreading / Potential Bugs | AvoidThreadGroup |
| DontCallThreadRun | |
| DoubleCheckedLocking | |
| Performance / Performance | BigIntegerInstantiation |
| Security / Security | All rules |
PMD CPD
Artemis uses the following default configuration to detect code duplications for the category Copy/Paste Detection. For a description of the various PMD CPD configuration parameters refer to the PMD CPD documentation.
<!-- Minimum amount of duplicated tokens triggering the copy-paste detection -->
<minimumTokens>60</minimumTokens>
<!-- Ignore literal value differences when evaluating a duplicate block.
If true, foo=42; and foo=43; will be seen as equivalent -->
<ignoreLiterals>true</ignoreLiterals>
<!-- Similar to ignoreLiterals but for identifiers, i.e. variable names, methods names.
If activated, most tokens will be ignored, so minimumTokens must be lowered significantly -->
<ignoreIdentifiers>false</ignoreIdentifiers>
C
GCC
For a description of the rules/warnings refer to the GCC Documentation. For readability reasons the rule/warning prefix -Wanalyzer- is omitted.
| Category (Tool/Artemis) | Rule |
|---|---|
| Memory Management / Potential Bugs | free-of-non-heap |
| malloc-leak | |
| file-leak | |
| mismatching-deallocation | |
| Undefined Behavior / Potential Bugs | double-free |
| null-argument | |
| use-after-free | |
| use-of-uninitialized-value | |
| write-to-const | |
| write-to-string-literal | |
| possible-null-argument | |
| possible-null-dereference | |
| Bad Practice / Bad Practice | double-fclose |
| too-complex | |
| stale-setjmp-buffer | |
| Security / Security | exposure-through-output-file |
| unsafe-call-within-signal-handler | |
| use-of-pointer-in-stale-stack-frame | |
| tainted-array-index | |
| Miscellaneous / Miscellaneous | Rules not matching to above categories |