I want to perform an automated static check analysis on my Groovy code to identify which clases doesn't have the @CompileStatic
annotation.
I'd like to know how that can be done either with IntelliJ or CodeNarc custom rule.
I want to perform an automated static check analysis on my Groovy code to identify which clases doesn't have the @CompileStatic
annotation.
I'd like to know how that can be done either with IntelliJ or CodeNarc custom rule.
For completeness sake, Codenarc has a CompileStatic Rule since 1.4
CompileStatic Rule
Since CodeNarc 1.4
Enforces classes are annotated either with one of the @CompileStatic, >@GrailsCompileStatic or @CompileDynamic annotations.
It's possible to use IntelliJ IDEA's Structural Search (Edit | Find | Search Structurally...) and its Structural Search Inspection for this purpose. Use a simple pattern like this:
File type
Groovy
, ContextFile
. And add a Script Constraint like the following (click onEdit Variables...
to add constraints):This should find all classes that do not have a
@CompileStatic
annotation