An apparent infinite loop (IL_INFINITE_LOOP)
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).
IT1901 Fall 2021 - 10th Lecture
automated tests
coding standards and consistent formatting
check for higher level types of errors (bug patterns)
decrease the effort for running and re-running tests
there are several types metrics that can be used to measure test coverage
Java Code Coverage (JaCoCo)
popular tool for measuring code coverage in Java projects
measures several metrics
Instructions
Branches (exception handling is excluded)
Cyclomatic Complexity - "According to McCabe1996 cyclomatic complexity is the minimum number of paths that can, in (linear) combination, generate all possible paths through a method."
Lines
Methods
Classes
Checkstyle (https://checkstyle.sourceforge.io/index.html)
Spotbugs (https://spotbugs.readthedocs.io/en/latest/index.html)
Pmd (https://pmd.github.io)
Sonarcube (https://www.sonarqube.org/)
…
static analysis
finds errors like
references to variables with undefined value
variables that are never used
syntax and coding standards violations
dead code blocks
naming conventions
line length
whitespace
Javadoc comments
annotations
can be configured to use a certain set of checks
extendable - one can write own checks
plugins for IDEs
checks bytecode and not the source
looks for "bug patterns"
example:
An apparent infinite loop (IL_INFINITE_LOOP)
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).
extendable
plugins for Maven Gradle Ant
Eclipse IDE integration