Details
Description
Violations and metrics are imported and shown, but the sources of the files are not shown.
-
- PhpSourceImporter.java.patch
- 29/Jul/11 3:56 AM
- 2 kB
- Gennadiy Litvinyuk
-
Hide
- sonar-php-plugin-0.4.jar
- 16/Sep/11 3:34 AM
- 322 kB
- pti
-
- META-INF/MANIFEST.MF 0.7 kB
- index.html 0.4 kB
- org/index.html 0.4 kB
- org/sonar/plugins/.../xml/Module.class 6 kB
- org/sonar/plugins/.../xml/Metadata.class 0.9 kB
- org/sonar/plugins/.../xml/Property.class 1 kB
- org/sonar/plugins/.../xml/MethodNode.class 0.8 kB
- org/sonar/plugins/.../xml/FunctionNode.class 2 kB
- org/sonar/plugins/.../xml/FileNode.class 4 kB
- org/sonar/plugins/.../xml/PackageNode.class 1 kB
- org/sonar/plugins/.../xml/MetricsNode.class 1 kB
- org/sonar/plugins/.../xml/ClassNode.class 3 kB
- org/.../ResourcesBag$MeasuresByMetric.class 1 kB
- org/sonar/.../PhpDependResultsParser.class 11 kB
- org/sonar/.../PhpDependSensor.class 3 kB
- org/sonar/.../PhpDependExecutor.class 3 kB
- org/sonar/.../phpdepend/ResourcesBag.class 2 kB
- org/sonar/.../PhpDependConfiguration.class 5 kB
- org/sonar/.../PhpCodeSnifferViolation.class 2 kB
- org/.../PhpCodeSnifferProfileExporter.class 7 kB
- org/sonar/.../PhpCodeSnifferExecutor.class 4 kB
- org/.../PhpCodeSnifferViolationsXmlParser.class 4 kB
- org/.../PhpCodeSnifferPriorityMapper.class 2 kB
- org/sonar/plugins/.../codesniffer/index.html 0.5 kB
- org/sonar/.../php-profile-with-cs.xml 240 kB
- org/sonar/.../PhpCodesnifferSensor.class 6 kB
- org/.../PhpCodeSnifferProfileImporter.class 7 kB
- org/.../PhpCodeSnifferRuleRepository.class 2 kB
- org/sonar/.../PhpCodeSnifferProfile.class 1 kB
- org/sonar/plugins/.../codesniffer/rules.xml 196 kB
Issue Links
- is duplicated by
-
SONARPLUGINS-1332
[PHP] Violation drilldown do not show source code review
-
Activity
Hello,
I have the same problem, we have already migrated to sonar 2.8.
Same here (on 2.8).
I read somewhere (sorry, no link) that the Sonar-API for Source-Code handling changed from 2.7 to 2.8. The PHP-Plugin implements the wrong Interface thus no code is displayed.
Is there a way for a quick fix?
Can I help / where to dig? Any pointer is highly appreciated!
This patch should fix the problem.
Compatibility with Sonar 2.9 was not tested
Thanks Gennadiy! I'll test your patch as soon as I can - hopefully tomorrow ![]()
OT
I can not build the plugin with mvn compile:
[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Sonar PHP Project ................................. SUCCESS [3.471s] [INFO] PHPMD Rulesets .................................... SUCCESS [0.828s] [INFO] PHP_CodeSniffer Rulesets .......................... SUCCESS [0.116s] [INFO] Sonar PHP Plugin .................................. FAILURE [5.977s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.672s [INFO] Finished at: Mon Aug 01 10:37:27 CEST 2011 [INFO] Final Memory: 14M/81M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sonar-php-plugin: Compilation failure: Compilation failure: [ERROR] /Users/ct/workspace/sonar-php-plugin-trunk/sonar-php-plugin/src/main/java/org/sonar/plugins/php/core/PhpSourceImporter.java:[140,19] cannot find symbol [ERROR] symbol : method index(org.sonar.api.resources.Resource<capture#932 of ?>) [ERROR] location: interface org.sonar.api.batch.SensorContext [ERROR] /Users/ct/workspace/sonar-php-plugin-trunk/sonar-php-plugin/src/main/java/org/sonar/plugins/php/core/PhpSourceImporter.java:[147,95] cannot find symbol
Is there a way I can fix that?
There is a
+import org.sonar.api.resources.Resource;
in Patch... with some other important imports.
Sebastian, this should work.
At least yesterday in the last version of my changes to this file, I did the same changes.
You should only delete some no more needed imports.
I think i got it working with sonar 2.9. At least it now displays the code.
I may not have followed the usual path not being knowledgable on maven stuffs, so just take it if useful, but what i had to do in my environment
- 1) change in pom.xml of sourcecode: i removed ref to dependencies such as phpmd-rulesets, and phpcodesniffer-rulesets: since i was getting complains when doing "mvn package"
- 2) i changed in the same pom.xml the properties "<qonar.runtimeVersion>. In what i got at that time it was 2.3 so getting compilation errors since i was using sonar 2.9
- 3) i also add to edit the patch file to remove "CoreProperties.ENCODING_PROPERTY"
BTW, do you know if we could get somewhere a repackaged version of that sonarphp plugin?
Thanks for fixing the plugin!
I installed the attached plugin on two sites without problems.
However I get blank outputs on some files and the option "Full source" does not work.
Here's an example to reproduce this effect:
- Open http://metrics.typo3.org/drilldown/violations/1996#
- Browse one of these files
- class.t3lib_tcemain
- class.t3lib_div
- class.t3lib_befunc
A quick check with firebug revealed that the response on POST http://metrics.typo3.org/resource/index/2128?metric=61&rule=&period=&display_title= is empty.
Is this related to this issue or a "GUI thingy"?
Any ideas?
i get the same