Is there a way to run PhpStorm inspections in TeamCity build?

Is there a way to run PhpStorm inspections in TeamCity build?

It should be very helpfull to increase code quality.

1 comment
Comment actions Permalink

Yes there is a way but I have some problems with results reporting.
According to this article we could use bundled IntelliJ IDEA it detects only typos on Symfony project.

[20:39:22]Step 1/1: Inspections (IntelliJ IDEA) (22s)
[20:39:22][Step 1/1] Initialization
[20:39:22][Step 1/1] Starting: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dagent.home.dir=/Users/ailyin/Desktop/TeamCity/buildAgent -Dagent.name=Default Agent -Dagent.ownPort=9090 -Dagent.work.dir=/Users/ailyin/Desktop/TeamCity/buildAgent/work -Dbuild.number=1 -Dbuild.vcs.number=400380eac1f5a5a0ba52978c23c292a408caaa79 -Dbuild.vcs.number.1=400380eac1f5a5a0ba52978c23c292a408caaa79 -Dbuild.vcs.number.SymfonyStandard=400380eac1f5a5a0ba52978c23c292a408caaa79 -Didea.build.agent.port=9090 -Didea.config.path=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/config -Didea.home.path=/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea -Didea.jars.nocopy=true -Didea.no.jdk.check=true -Didea.plugins.path=/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/plugins -Didea.system.path=/Users/ailyin/Desktop/TeamCity/buildAgent/system/.intellij_idea/e02e07e4af956d10/system -Djava.awt.headless=true -Djava.io.tmpdir=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp -Djava.library.path=/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/bin -Dnewlocalvcs.disabled=true -Dteamcity.agent.cpuBenchmark=640 -Dteamcity.agent.dotnet.agent_url=http://localhost:9090/RPC2 -Dteamcity.agent.dotnet.build_id=3 -Dteamcity.auth.password=IG4dyYCVMx1J1oLRH83dY5mjipY9Oo2Z -Dteamcity.auth.userId=TeamCityBuildId=3 -Dteamcity.build.changedFiles.file=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/changedFiles6002173026812586085.txt -Dteamcity.build.checkoutDir=/Users/ailyin/Desktop/TeamCity/buildAgent/work/e02e07e4af956d10 -Dteamcity.build.id=3 -Dteamcity.build.properties.file=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/teamcity.build4920673587890887743.properties -Dteamcity.build.tempDir=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp -Dteamcity.build.workingDir=/Users/ailyin/Desktop/TeamCity/buildAgent/work/e02e07e4af956d10 -Dteamcity.buildConfName=Symfony -Dteamcity.buildType.id=SensioLabs_Symfony -Dteamcity.configuration.properties.file=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/teamcity.config4650690549904048748.properties -Dteamcity.projectName=SensioLabs -Dteamcity.runner.properties.file=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/teamcity.runner8839658926381037588.properties -Dteamcity.tests.recentlyFailedTests.file=/Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/testsToRunFirst3292398490154231539.txt -Dteamcity.version=9.0.1 (build 32116) -Xmx512m -XX:MaxPermSize=150m -Xbootclasspath/p:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/boot.jar -classpath /Library/Java/Home/lib/tools.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/bootstrap.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/extensions.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/openapi.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/util.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/jdom.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/log4j.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/trove4j.jar:/Users/ailyin/Desktop/TeamCity/buildAgent/tools/idea/lib/jna.jar com.intellij.idea.Main inspect /Users/ailyin/Desktop/TeamCity/buildAgent/work/e02e07e4af956d10 project /Users/ailyin/Desktop/TeamCity/buildAgent/temp/buildTmp/inspection5556313028787889216result -profileName PHPStorm -v3
[20:39:22][Step 1/1] in directory: /Users/ailyin/Desktop/TeamCity/buildAgent/work/e02e07e4af956d10
[20:39:29][Step 1/1] Starting up IntelliJ IDEA 14.0.2 ...done.
[20:39:38][Step 1/1] Opening project...done.
[20:39:38][Step 1/1] Initializing project...Loaded shared project profile 'PHPStorm'
[20:39:38][Step 1/1] done.
[20:39:38][Step 1/1] Inspecting with profile 'PHPStorm'
[20:39:39][Step 1/1] Analyzing code ... 2%
[20:39:39][Step 1/1] Analyzing code ... 4%
[20:39:39][Step 1/1] Analyzing code ... 7%
[20:39:40][Step 1/1] Analyzing code ... 9%
[20:39:40][Step 1/1] Analyzing code ... 11%
[20:39:40][Step 1/1] Analyzing code ... 14%
[20:39:40][Step 1/1] Analyzing code ... 16%
[20:39:40][Step 1/1] Analyzing code ... 19%
[20:39:40][Step 1/1] Analyzing code ... 21%
[20:39:40][Step 1/1] Analyzing code ... 23%
[20:39:40][Step 1/1] Analyzing code ... 26%
[20:39:40][Step 1/1] Analyzing code ... 28%
[20:39:40][Step 1/1] Analyzing code ... 30%
[20:39:40][Step 1/1] Analyzing code ... 33%
[20:39:40][Step 1/1] Analyzing code ... 35%
[20:39:40][Step 1/1] Analyzing code ... 38%
[20:39:40][Step 1/1] Analyzing code ... 40%
[20:39:40][Step 1/1] Analyzing code ... 42%
[20:39:40][Step 1/1] Analyzing code ... 45%
[20:39:40][Step 1/1] Analyzing code ... 47%
[20:39:40][Step 1/1] Analyzing code ... 50%
[20:39:40][Step 1/1] Analyzing code ... 52%
[20:39:40][Step 1/1] Analyzing code ... 54%
[20:39:40][Step 1/1] Analyzing code ... 57%
[20:39:40][Step 1/1] Analyzing code ... 59%
[20:39:40][Step 1/1] Analyzing code ... 61%
[20:39:40][Step 1/1] Analyzing code ... 64%
[20:39:40][Step 1/1] Analyzing code ... 66%
[20:39:40][Step 1/1] Analyzing code ... 69%
[20:39:40][Step 1/1] Analyzing code ... 71%
[20:39:40][Step 1/1] Analyzing code ... 73%
[20:39:40][Step 1/1] Analyzing code ... 76%
[20:39:40][Step 1/1] Analyzing code ... 78%
[20:39:40][Step 1/1] Analyzing code ... 80%
[20:39:40][Step 1/1] Analyzing code ... 83%
[20:39:40][Step 1/1] Analyzing code ... 85%
[20:39:40][Step 1/1] Analyzing code ... 88%
[20:39:40][Step 1/1] Analyzing code ... 90%
[20:39:40][Step 1/1] Analyzing code ... 92%
[20:39:40][Step 1/1] Analyzing code ... 95%
[20:39:40][Step 1/1] Analyzing code ... 97%
[20:39:40][Step 1/1] Analyzing code ... 100%
[20:39:40][Step 1/1] Done.
[20:39:43][Step 1/1] Process exited with code 0
[20:39:44]Publishing internal artifacts
[20:39:44][Publishing internal artifacts] Sending using WebPublisher
[20:39:44][Publishing internal artifacts] Sending using ArtifactsCachePublisher

[20:39:45]Total: 381 (+0 -0) Errors: 0 (+0 -0)


But you could run PHPStorm in CLI to generate *.xml reports like those:

PhpDocMissingThrowsInspection.xml
PhpDocSignatureInspection.xml
PhpIncludeInspection.xml
PhpLanguageLevelInspection.xml
PhpParamsInspection.xml
PhpUndefinedClassInspection.xml
PhpUndefinedConstantInspection.xml
PhpUndefinedFieldInspection.xml
PhpUndefinedFunctionInspection.xml
PhpUndefinedMethodInspection.xml
PhpUndefinedNamespaceInspection.xml
PhpUnreachableStatementInspection.xml
PhpUnusedLocalVariableInspection.xml
PhpUnusedParameterInspection.xml
PhpUnusedPrivateMethodInspection.xml
SpellCheckingInspection.xml
XmlHighlighting.xml
XmlUnboundNsPrefix.xml
XmlUnusedNamespaceDeclaration.xml


But looks like they are stored in JetBrains format and there is no such parcer in Builds Features / XML Reports Processing in TeamCity so there could be undocumented feature to process them or you could use XSLT to convert reports to supported formats.

0

Please sign in to leave a comment.