Code inspection report.

Hi.

I would like to ask if I can somehow run the inspection code from the command line and get the report as a file? XML or even plain file?

I have a big project that I need to clean and if I could generate such a report every now and then, it would really help me. Maybe copy code inspection to TeamCity?

Best regards.

0
11 comments

Please look here
http://www.jetbrains.com/idea/webhelp/running-inspections-offline.html
(We'll update WS/PS docs later)

As for TeamCity - it has built-in inspection runner for all inspections available in IDEA Ultimate, so you need to just provide your inspection profile to Inspection build runner.

0

FYI, are you aware that those webhelp pages don't work in IE9, unless I turn Compatability View on?

0

I was sooo excited to see this, but here is the batch files it says to run:

@echo off
call idea.bat inspect %*


idea.bat does not exist in that folder. Should it?

Also, what is inspect_diff.bat?

0

Grzegorz Drozd,

Does idea.bat exist in your \bin folder (or are you on Linux, and if so, does the inspect.sh file exist)?

0

well, replace with IDENAME.bat

basically commandline is
IDE.exe inspect "AllOtherOptionsAsDescribedInHelp"

0

Nope. There are way too much browsers nowadays as for me. Anyway, I forwarded your request to appropriate department.

0

I'm confused when I run inspect.bat like this:

inspect.bat C:\inetpub\Intranet_Local\.idea\Intranet_Local.iml C:\inetpub\Intranet_Local\.idea\inspectionProfiles\Critical.xml c:\result.xml -v2

I get this:

Starting up JetBrains PhpStorm 2.1.2 ...done.
Opening project...[   2414]  ERROR - spection.InspectionApplication - null
java.lang.NullPointerException
at com.intellij.codeInspection.InspectionApplication.a(InspectionApplica
tion.java:115)
at com.intellij.codeInspection.InspectionApplication.access$200(Inspecti
onApplication.java:59)
at com.intellij.codeInspection.InspectionApplication$1.run(InspectionApp
lication.java:93)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(A
pplicationImpl.java:754)
at com.intellij.codeInspection.InspectionApplication.startup(InspectionA
pplication.java:85)
at com.intellij.codeInspection.InspectionMain.main(InspectionMain.java:9
1)
at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:110)
at com.intellij.idea.MainImpl$3.run(MainImpl.java:156)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessCo
ntrolContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:612)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[   2415]  ERROR - spection.InspectionApplication - JetBrains PhpStorm 2.1.2  Bu
ild #PS-107.425
[   2416]  ERROR - spection.InspectionApplication - JDK: 1.6.0_24
[   2416]  ERROR - spection.InspectionApplication - VM: Java HotSpot(TM) Client
VM
[   2416]  ERROR - spection.InspectionApplication - Vendor: Sun Microsystems Inc
.
[   2416]  ERROR - spection.InspectionApplication - OS: Windows 7
[   2416]  ERROR - spection.InspectionApplication - Last Action:
null

But you are saying to run it like this?

C:\Program Files (x86)\PHPStorm\bin>PhpStorm.exe inspect C:\inetpub\Intranet_Local\.idea\Intranet_Local.iml C:\inetpub\Intranet_Local\.idea\inspectionProfiles\Critical.xml c:\result.xml -v2

0

well judging the contents of the bat file this is essentially the same.

As for the error - it might be just broken in current build (almost nobody uses it).
I'll investigate it a bit..

0

I imagine, but we've been wanting something like this for some time. I was so excited to see your response to his post. I never saw that feature added.

0

Its a part of the IDEA and the platform and is used there and by TeamCity for running automated Inspection bulds on your project on the separate agents.
Inspections can run for 12 hours for a huge project.. Also TC provides a diff - i.e. lists all NEW problems for a build (which can be run per check in or daily or...)

0

Please sign in to leave a comment.