[ANN] Inspection Gadgets 0.0.10 release


Announcing version 0.0.10 of the InspectionGadgets plugin, available via the PluginManager or at http://www.intellij.org/twiki/bin/view/Main/InspectionGadgets.

Changes in version 0.0.10

New inspections:

  • Local variable used and declared in different 'switch' branches

  • Empty 'try' block

  • 'instanceof' on 'catch' parameter

  • For loop may be replaced by while loop

  • Non-static inner class in secure context


Added option to "Empty statement body" to report statements whose bodies are empty block statements.
Added option to "Empty catch block" inspection to ignore empty catch blocks in JUnit test cases.
All naming and visibility inspections now have quick-fixes which trigger the "Rename" refactoring. Such quick-fixes are available only from the on-line inspection, not from the batch inspection tool.
Bugfixes.

0
Avatar
Permanently deleted user

Suggestion for inspection:

Statement without brackets: report all if/else/for/while/do statements
without brackets surrounding the statement body.

0
Avatar
Permanently deleted user


This was actually in the original release, but was taken out because JetBrains added automatic wrapping of such statements to their code formatter. In retrospect, that might have been over-enthusiastic of me.

--Dave

0
Avatar
Permanently deleted user

I like and have this setting turned on, but I was thinking
on this inspection as a security measure (especially when
looking/changing thrd party code).

This is a bad code smell: one never knows if/when the brackets are
missing around more than one statement or wether the body should be
empty instead of having the "default" statement.

Being able to inspect the occurences before changing them would be a
bonus.

0
Avatar
Permanently deleted user

Cool...

BTW, I submitted a feature request to Intellij about extending the API
to allow for file/URL resources. The request is:
http://www.intellij.net/tracker/idea/viewSCR?publicId=26431. They've
given it a high priority, so I'll keep my fingers crossed.

Thanks again for such a great (and useful) plugin. I noticed that this
seems to be the most commonly downloaded plugin, so evidently a lot of
people agree!

Douglas Bullard



In article <31865537.1074530340534.JavaMail.itn@is.intellij.net>,
dave.griffith@cnn.com says...


Announcing version 0.0.10 of the InspectionGadgets plugin, available via the PluginManager or at http://www.intellij.org/twiki/bin/view/Main/InspectionGadgets.

Changes in version 0.0.10

New inspections:

  • Local variable used and declared in different 'switch' branches

  • Empty 'try' block

  • 'instanceof' on 'catch' parameter

  • For loop may be replaced by while loop

  • Non-static inner class in secure context


Added option to "Empty statement body" to report statements whose bodies are empty block statements.
Added option to "Empty catch block" inspection to ignore empty catch blocks in JUnit test cases.
All naming and visibility inspections now have quick-fixes which trigger the "Rename" refactoring. Such quick-fixes are available only from the on-line inspection, not from the batch inspection tool.
Bugfixes.

0
Avatar
Permanently deleted user

I was messing with the code around if statement:
if (talentThreshold) {
row.getReview().setThresholdBroken()|;

} else {
//we only want to
display |= row.getReview().isThresholdBroken();
}

My cursor was where '|' is and then I pressed '='.
IDEA went looping with the exception window. Luckily yout Alt+I shortcut works, thanks for it! :)


Error message: Exception happened in local inspection tool: Unnecessary 'if' statement
java.lang.NullPointerException

at com.siyeh.ig.verbose.TrivialIfInspection.isAssignment(TrivialIfInspection.java:198)

at com.siyeh.ig.verbose.TrivialIfInspection.access$400(TrivialIfInspection.java:12)

at com.siyeh.ig.verbose.TrivialIfInspection$TrivialIfVisitor.visitIfStatement(TrivialIfInspection.java:146)

at com.intellij.psi.impl.source.f.a.t.accept(t.java:45)

at com.intellij.psi.impl.source.f.s.acceptChildren(s.java:57)

at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java)

at com.intellij.psi.JavaElementVisitor.visitCodeBlock(JavaElementVisitor.java:110)

at com.intellij.psi.impl.source.f.a.br.accept(br.java:13)

at com.intellij.psi.impl.source.q.acceptChildren(q.java:16)

at com.intellij.psi.PsiRecursiveElementVisitor.visitElement(PsiRecursiveElementVisitor.java)

at com.intellij.psi.JavaElementVisitor.visitMethod(JavaElementVisitor.java:143)

at com.intellij.psi.impl.source.be.accept(be.java:111)

at com.siyeh.ig.ExpressionInspection.checkMethod(ExpressionInspection.java:50)

at com.intellij.codeInsight.c.a.i.a(i.java:58)

at com.intellij.codeInsight.c.a.bk$1.run(bk$1.java:9)

at com.intellij.openapi.application.a.b.runReadAction(b.java:319)

at com.intellij.codeInsight.c.a.bk.a(bk.java:2)

at com.intellij.codeInsight.c.a.bk.access$100(bk.java:11)

at com.intellij.codeInsight.c.a.bk$0.run(bk$0.java:3)

at com.intellij.progress.ProgressManager.runProcess(ProgressManager.java:52)

at com.intellij.codeInsight.c.a.bk.run(bk.java:20)

0
Avatar
Permanently deleted user

Dave,

In the "Too Many fields in a class" complexity measure, does it sound reasonable to provide an option to not count static final fields that are initialized (i.e. constants).

For me, too many fields is largly driven by the number of modifiable fields.

Thanks,
Mike

0
Avatar
Permanently deleted user

Actually, it was just supposed to be ignoring constants always. It's not, which is a bug. A fix will be in the next release.

0

请先登录再写评论。