CodeNarc/CodeNarc — pull request #14 by ArturGajowy (2013-04-21 21:15:10+00:00)
Title: new CloneWithoutCloneable rule and per-rule custom compilation phase support for more type information in AST

The new rule couldn't be implemented without some framework/infrastructure changes (separated into their own commit, tests included ofc ;)). I tried to make the changes as small as possible and fully backwards compatible - and I think I've achieved it.

Rationale for the framework change is supported in CustomCompilerPhaseSourceDecoratorTest and in the implementation of CloneWithoutCloneableRule. (Try commenting out `int requiredAstCompilerPhase = Phases.SEMANTIC_ANALYSIS` in CloneWithoutCloneableRule and see that the tests fail).

Also, about 6 of 12 rules in my shortlist of rules to implement turned out to need this additional type information in AST. What's more, if we were to - as HamletDRC suggested - migrate to Groovy 2.0 in order to use type information available from @CompileStatic, we need an option to use latter compilation phases anyway (as static type checking runs in Phase.CANONICALIZATION, according to [this comment](http://docs.codehaus.org/display/GroovyJSR/GEP+8+-+Static+type+checking?focusedCommentId=227052097#comment-227052097))

I think in future I should consult such efforts before undertaking them... Anyway, I hope you'll like the outcome and will merge it in :) Should you like me to elaborate more on any aspect of these commits - I am at your disposal :)

Best regards,
Artur Gajowy