What is the best plugin for code analysis in groovy? - grails

I am using Grails 2.0.3 as platform and Netbeans 7.1 as an IDE. Which of the available plugins for code analysis in groovy works best? Codenarc and GMetrics are on my list.
Anyone who have tried these? Which one is better?

CodeNarc and GMetrics both analyze different things. CodeNarc checks code for style, best practices and other inconsistencies. GMetrics analyzes the complexity of your code and will tell you the cyclomatic complexity and line counts and whatnot.
If I was only going to use one of these plugins, I would use CodeNarc because it helps train you to follow best practices in your code and will improve your code quality. However, there is no reason why you shouldn't or can't use both.

Related

UCD equivalent for Groovy/Grails?

In Java projects I use UCD for cleaning dead/unnecessary code, and I love it.
Is there an equivalent in Groovy/Grails land?
Given the highly dynamic nature of Groovy it would be very difficult (if at all possible) to do something similar to this.
I haven't seen any tools that are capable of what you are looking for and I doubt any exist for the reasons above.
The codenarc project (Static Analysis for Groovy) has some rules to detect unused and unnecessary code.

Building Rascal from source

I'm thinking it might be easiest if I modify the Java syntax used in Rascal to better fit our Java-like language.
Is there a way I can build Rascal from the source? I've cloned the repo from Github and imported it as a project into Eclipse but there are some compilation errors regarding org.eclipse.imp. Before I head down the rabbit-hole of trying to get this all to work in Eclipse I thought I would post here to see if there is an easy way to handle this.
Thanks!
Sure you could build Rascal from scratch; following the developer instructions at https://github.com/cwi-swat/rascal/wiki/Rascal-Developers-Setup---Step-by-Step
On the other hand, if you wish to simply adapt the Java syntax definition it would be better to clone it into your own files. Grammars may look modular, but in reality there are complex interactions between different parts of the grammar. Better to clone and manage the whole thing as your own than depend on two co-evolving definitions.
If you clone the Java grammar Rascal will generate new parsers for you on-the-fly. If this generation becomes cumbersome, a "cached parser" can help you to optimize the deployment of your tools. Please contact us if you need help with that.

Good alternative for ant for use on jenkins build server

Hy there. I have a number of software projects (also iOS and OSX) which I build with Apache ant`.
Although I quite like Ant it is often too verbose and some things which should be easy are quite tricky or I have to use shell scripts along with ant.
Is there a good alternative for which is extensible, easy to use and should work well on my jenkins build server.
Thanks for your input.
Have a look at Gradle - it's quite different from Ant and may take a little while to get your head around, but I think it's going to be the new standard for build systems. One nice thing is that it has full Ant support under the hood, so you can easily get your existing Ant builds running and then port them to Gradle.
Gareth's answer of Gradle is a good one. But do take a look at what you are doing that is hard with Ant. In my experience, a fair portion of the time its "non-build" stuff. Perhaps leave Ant for the pure build stuff, and use an alternate tool for and deploy or test stuff that's snuck in there.
Although gradle looks very promising I decided to use Rake instead.
I should say that this is a biased decision since I am already using ruby for other parts in my build setup. I found a good Article by Martin Fowler
Another point is that by doing OSX development the platform-independence-aspect of Ant (or Gradle) does not have such a big weight for me.
BTW Besi's Rake answer:
JRuby's Rake+Ant integration seems like a really powerful combo:
http://www.engineyard.com/blog/2010/rake-and-ant-together-a-pick-it-n-stick-it-approach
One big advantange there, it fully supports integration with Ant, allowing step-by-step migration.. which IMHO is only viable strategy for large, existing projects.
Gradle seems similar and while it looks good; I think learning Rake could be a better investment as it's more universal outside of Java.
(The other thing I'm seriously considering is BuildR http://buildr.apache.org, but Jenkins doens't explicitly support it yet, so have to use scripted build steps, which seems less preferable. TODO: a BuildR plugin).

Cucumber IDE for feature writing with autocomplete?

Is there any Eclipse plugin for writing features for cucumber with autocomplete functionality?
I guess that would be good to find and reuse steps from other features. Any ideas?
The cucumber-eclipse plugin illustrates one possible approach.
As Xtext seems not to be the perfect solution for this special case, it is more like a case study then a working plugin.
Based on XText, it uses the cucumber grammar (as in Gherkin), it uses XText features to produce a full-fledge editor.

Groovy/Grails plugin for Sonar

Sonar is an application for integrating output from several static and test analysis tools into a comprehensive overview of the software's quality.
Unfortunately, most of those analysis tools (PDM, FindBugs, etc.) do not support Groovy and, by extension, Grails.
We've found tools called CodeNarc and GMetrics which perform some of the analysis, but not test coverage, and we're working on a Sonar plugin to import the CodeNarc output. As I said, though, this is incomplete.
Does anyone know of a better set of complexity/rules-based static analysis tools that can handle Groovy, as well as a Grails test coverage metric? Of course, one with a Sonar plugin for reading in the output would be best.
Just use Sonar Groovy Plugin!
It leverages GMetrics, Codenarc and Cobertura in Sonar!
Here are the tools I'm aware of (and just aware):
There is CodeNarc that you mentioned.
There is also GMetrics.
And Grails has a Test Code Coverage Plugin.
But nothing ready to be used with Sonar AFAIK. I'm watching SONARPLUGINS-194 about this but there isn't much activity although some work has been reported very recently, maybe be you :)

Resources