Details
Description
I'm setting File suffixes [sonar.php.file.suffixes] in Sonar php configuration,
but running mvn sonar:sonar reverts to defaults
Issue Links
- is duplicated by
-
SONARPLUGINS-960
Settings for suffixes not working (File suffixes [sonar.php.file.suffixes])
-
Activity
this issue was previously addressed: http://jira.codehaus.org/browse/SONARPLUGINS-565
Supposed to be working, but I cant get it to work. Latest snapshot (0.4) also has the same behavior.
I suggest this issue to be closed and 565 reopened?
Miguel,
could you please provide some logs to check that the added file suffixe is not taken into account?
In fact, the expected behaviour, is to append the specified file suffixes to the default.
Hi,
it's quite easy to reproduce, just try to get a somefile.module parsed...
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.neoscopio</groupId> <artifactId>Drupal.Core</artifactId> <name>Drupal Core</name> <version>6.0</version> <!-- For the moment, specify pom as packaging for php projects --> <packaging>pom</packaging> <!-- some properties that you may want to change --> <properties> <sonar.language>php</sonar.language> <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> <sonar.phpPmd.analyzeOnly >true</sonar.phpPmd.analyzeOnly> <sonar.phpCodesniffer.analyzeOnly>true</sonar.phpCodesniffer.analyzeOnly> <sonar.phpDepend.analyzeOnly>true</sonar.phpDepend.analyzeOnly> <sonar.phpUnit.coverage.analyzeOnly>true</sonar.phpUnit.coverage.analyzeOnly> <sonar.phpUnit.analyzeOnly>true</sonar.phpUnit.analyzeOnly> <sonar.phpcpd.analyzeOnly>true</sonar.phpcpd.analyzeOnly> <sonar.exclusions>sites/all/,files</sonar.exclusions> <sonar.php.file.suffixes>php,inc,module</sonar.php.file.suffixes> </properties> <build> <!-- You cannot omit this one, because maven will implicitely add src/main/java to it --> <sourceDirectory>${basedir}</sourceDirectory> <testSourceDirectory>${basedir}/sonardir</testSourceDirectory> </build> </project>
If I change the pom just enough to run a tool, (e.g. phpcpd) :
$ mvn -e sonar:sonar
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO] Ignoring available plugin update: 2.0-beta-2 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 2.0-beta-1 as it requires Maven version 3.0
[INFO] ------------------------------------------------------------------------
[INFO] Building Drupal Core
[INFO] task-segment: [sonar:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://localhost:9000
[INFO] Sonar version: 2.5
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:2.5:sonar
[INFO] [sonar:sonar {execution: default-sonar}]
[INFO] Database dialect class org.sonar.jpa.dialect.Derby
[INFO] ------------- Analyzing Drupal Core
[INFO] Excluded sources : [sites/all/, files]
[INFO] Selected quality profile : [name=PHP_CodeSniffer rules,language=php]
[INFO] Compare to previous analysis (2011-02-12 00:22:56.71)
[INFO] Compare over 5 days (2011-02-12 00:22:56.71)
[INFO] Compare over 30 days (2011-02-12 00:22:56.71)
[INFO] Detection of duplication code is not supported for PHP.
[INFO] Configure maven plugins...
[INFO] Sensor AsynchronousMeasuresSensor...
[INFO] Sensor AsynchronousMeasuresSensor done: 301 ms
[INFO] Sensor PhpSourceImporter[getLanguage()=PHP,getClass()=class org.sonar.plugins.php.core.PhpSourceImporter]...
[INFO] Importing files from project Drupal Core
[INFO] core-drupal
[INFO] sonardir
[INFO] Sensor PhpSourceImporter[getLanguage()=PHP,getClass()=class org.sonar.plugins.php.core.PhpSourceImporter] done: 34625 ms
[INFO] Sensor org.sonar.plugins.php.core.NoSonarAndCommentedOutLocSensor@1d36f77...
[INFO] Sensor org.sonar.plugins.php.core.NoSonarAndCommentedOutLocSensor@1d36f77 done: 2177 ms
[INFO] Sensor ProfileSensor...
[INFO] Sensor ProfileSensor done: 0 ms
[INFO] Sensor ProjectLinksSensor...
[INFO] Sensor ProjectLinksSensor done: 237 ms
[INFO] Sensor VersionEventsSensor...
[INFO] Sensor VersionEventsSensor done: 41 ms
[INFO] Sensor Maven dependencies...
[INFO] Sensor Maven dependencies done: 7 ms
[INFO] Sensor PhpCodesnifferSensor...
[INFO] Report file for: phpcs : /home/alienation/projects/sonar/core-drupal/target/logs/codesniffer.xml
[INFO] PhpCodeSniffer report file: /home/alienation/projects/sonar/core-drupal/target/logs/codesniffer.xml
[INFO] No violation found in repository php_codesniffer_rules for violation Generic.ControlStructures.InlineControlStructure.Discouraged
[INFO] No violation found in repository php_codesniffer_rules for violation PEAR.WhiteSpace.ScopeIndent.Incorrect
[INFO] Sensor PhpCodesnifferSensor done: 100857 ms
[INFO] Sensor PHP Depend Sensor...
[INFO] Report file for: pdepend : /home/alienation/projects/sonar/core-drupal/target/logs/pdepend.xml
[INFO] Collecting measures...
[WARN] The following file doesn't belong to current project sources or tests :
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/aggregator/aggregator.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/block/block.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/blog/blog.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/blogapi/blogapi.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/book/book.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/color/color.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/comment/comment.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/contact/contact.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/dblog/dblog.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/filter/filter.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/forum/forum.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/help/help.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/locale/locale.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/menu/menu.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/node/node.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/openid/openid.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/path/path.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/php/php.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/ping/ping.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/poll/poll.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/profile/profile.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/search/search.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/statistics/statistics.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/syslog/syslog.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/system/system.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/taxonomy/taxonomy.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/throttle/throttle.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/tracker/tracker.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/translation/translation.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/trigger/trigger.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/update/update.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/upload/upload.module
[WARN] The following file doesn't belong to current project sources or tests : /home/alienation/projects/sonar/core-drupal/modules/user/user.module
[INFO] Saving measures...
[INFO] Sensor PHP Depend Sensor done: 814 ms
[INFO] Sensor org.sonar.plugins.php.cpd.PhpCpdSensor@1026e40...
[INFO] Report file for: phpcpd : /home/alienation/projects/sonar/core-drupal/target/logs/php-cpd.xml
[INFO] Executing phpcpd with command 'phpcpd --min-lines 3 --min-tokens 5 --log-pmd /home/alienation/projects/sonar/core-drupal/target/logs/php-cpd.xml --suffixes php,php3,php4,php5,phtml,inc /home/alienation/projects/sonar/core-drupal'
found::1458phpcpd 1.3.2 by Sebastian Bergmann.
As you can see:
[INFO] Executing phpcpd with command 'phpcpd --min-lines 3 --min-tokens 5 --log-pmd /home/alienation/projects/sonar/core-drupal/target/logs/php-cpd.xml --suffixes php,php3,php4,php5,phtml,inc /home/alienation/projects/sonar/core-drupal'
This happens with all the tools. (suffixes and also exclusions are not respected)
I've also tried the following:
Downloaded snapshot code from svn, greped for "php3"
$ grep -R "php3" * main/java/org/sonar/plugins/php/core/PhpPlugin.java: public static final String DEFAULT_SUFFIXES = "php,php3,php4,php5,phtml,inc,module"; main/java/org/sonar/plugins/php/core/.svn/text-base/PhpPlugin.java.svn-base: public static final String DEFAULT_SUFFIXES = "php,php3,php4,php5,phtml,inc";
Just one line? well, I've changed to include "module" (as you can see above) build the plugin,
but no cigar. "module" appears in the configuration page, but the behavior is still the same.
I've also tried to change to "php,inc,module" but the same original line keeps appearing, and I couldn't find where is defined.
Extra configuration for modifying file suffixes does not follow the same process as the other configuration parameters because of design.
To workaround SONAR-1461 a previous implementation was done, but changed to another one that was not correct.
The current implementation uses PHP.setConfiguration(configuration) on each executor.
Also doesn't work by setting the pom.
Eg:
<sonar.php.file.suffixes>module,php,inc,php3</sonar.php.file.suffixes>