Hello all,
At work we are using several tools to capture several metrics (mostly cyclomatic complexity and LCOM). We use those to get warning flags and to guide pre-emptive refactoring efforts. It's been very beneficial in increasing code quality.
However, the process is not tied to the build process. It is conducted separately. Moreover, I'm looking for something that can be made intrinsic to the source code (as opposed to an external process ran on it.)
Is anyone aware of a group of annotations and configurable annotation processor(s) that can be run from the compiler, and which will make the build fail if code doesn't comply with threshold cyclomatic/LCOM metrics?
I guess I could run ckjm, checkstyle and pmd from maven/ant, BUT some work on source code, and others work on bytecode. It would be nice to have one consolidated tool that works on the source code before compilation begins.
The other thing is that it'd be nice if there are sets of annotations that could drive this (to allow customization that will be inevitably be needed for corner cases.)
@LCOM3(Threshold=1.5)
public class SomeDumbPojo {... buch of gets/sets...}
// by default would be measured against a strict LCOM3
public class ActualBizClass
{
@CYCLOMATIC_COMPLEXITY(Threshold=15)
public void someFatIrreducibleMethod(){...}
}
Then, when we run the tool, by default applies strict (and configurable) metric threshold except on those artifacts that are annotated with (hopefully documented and legitimate) more relaxed thresholds. For some methods that cannot/should not be reduced, a relaxed cyclomatic complexity makes sense. For plain POJOs w/o behavior, LCOMs need to be relaxed... and so forth and so forth.
Looking and googling as I might, I have not been able to find anything (hopefully open source). But I might as well ask here just in case anyone is aware of anything of the sort.
Thanks.