In preparation for the Groovy IDE Shootout at Groovy.MN next Tuesday, I decided to crack open my IDEA settings pane today and see that additional inspections the JetGroovy plugin defines for IDEA.
Here's a rundown of the more exciting ones:
Control Flow - "Conditional expression can be conditional call" teaches you to use ?. instead of conditionals. Nice. "Conditional expression can be elvis" teaches you to use ?:, which in my opinion is confusing but some people like it. And "'return' statement can be implicit" reminds you the return keyword is optional. There's also a bunch of other inspections similar to the Java ones, like "Constant if statement", "Loop statement that doesn't loop", and "Redundant conditional expression".
Potentially confusing code constructs - The same inspections from Java, such as "Statement with empty body", "Negated conditional expression", "Overly complex arithmetic expression", and "Pointless boolean expression". I find the pointless expressions inspections helpful, especially during refactorings.
Threading issues - I've professed my love for the Java threading inspections before, and the plugin brings many of them to the Groovy platform. There are 18 inspections in this category, and I've found "Unsynchronized method overrides synchronized method", "Synchronization on non-final field", and "Synchronization on variable initialized with literal" to be invaluable.
Assignment issues - Again, many standard inspections from Java, such as "Assign to Method Parameter", "Silly Assignment", and "Result of Assignment Used". These are mostly good for keeping up with coding standards or just flagging your Friday afternoon code as crappy.
Probable bugs - I've never actually had these show up, but I suppose inspections like "Divide by zero", "Infinite recursion", and "Result of object allocation ignored" could help someone out there who despises unit tests.
The full list of inspections is available on the JetGroovy wiki, and don't forget to download the IDEA RefCardz from DZone. I heard the author is a nice guy.
1 comment:
Which inspections are giving false positives for you? Could you report these cases to JIRA?
Post a Comment