在Eclipse中创建跟随Java类,它会说有一个重复的局部变量错误,
public class Test {
public static void main(String[] args) {
hello();
}
private static void hello() {
int a=1;
int a=1;
}
}
然后你用SonarQube分析这个Java类,可以毫无问题地进行分析,不应该报告语义问题吗?
INFO: SonarQube Server 5.1.1
21:46:51.395 INFO - Load global repositories
21:46:51.609 INFO - Load global repositories (done) | time=218ms
21:46:51.611 INFO - Server id: 20150702122849
21:46:51.614 INFO - User cache: /home/administrator/.sonar/cache
21:46:51.622 INFO - Install plugins
21:46:51.700 INFO - Install JDBC driver
21:46:51.707 INFO - Create JDBC datasource for jdbc:postgresql://localhost/sonar
21:46:53.026 INFO - Initializing Hibernate
21:46:54.946 INFO - Load project repositories
21:46:55.036 INFO - Load project repositories (done) | time=91ms
21:46:55.036 INFO - Load project settings
21:46:55.400 INFO - Load technical debt model
21:46:55.427 INFO - Apply project exclusions
21:46:55.700 INFO - ------------- Scan test/platform/frameworks/av
21:46:55.710 INFO - Load module settings
21:46:55.897 INFO - Load rules
21:46:56.119 INFO - Base dir: /home/administrator/tmp/frameworks/av
21:46:56.119 INFO - Working dir: /home/administrator/tmp/frameworks/av/.sonar
21:46:56.120 INFO - Source paths: .
21:46:56.121 INFO - Source encoding: ISO-8859-2, default locale: en_US
21:46:56.121 INFO - Index files
21:46:56.344 INFO - 1 files indexed
21:46:56.390 INFO - Quality profile for java: Sonar way
21:46:56.424 INFO - Sensor JavaSquidSensor
21:46:57.107 INFO - Java Main Files AST scan...
21:46:57.112 INFO - 1 source files to be analyzed
21:46:57.416 INFO - Java Main Files AST scan done: 309 ms
21:46:57.417 INFO - 1/1 source files have been analyzed
21:46:57.417 WARN - Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor@51e55964, org.sonar.java.checks.UnusedPrivateMethodCheck@431dc52b, org.sonar.java.checks.RedundantThrowsDeclarationCheck@7fa7f0c8 are disabled.
21:46:57.417 INFO - Java Test Files AST scan...
21:46:57.418 INFO - 0 source files to be analyzed
21:46:57.418 INFO - Java Test Files AST scan done: 1 ms
21:46:57.418 INFO - 0/0 source files have been analyzed
21:46:57.443 INFO - Sensor JavaSquidSensor (done) | time=1019ms
21:46:57.443 INFO - Sensor Lines Sensor
21:46:57.445 INFO - Sensor Lines Sensor (done) | time=2ms
21:46:57.445 INFO - Sensor QProfileSensor
21:46:57.450 INFO - Sensor QProfileSensor (done) | time=5ms
21:46:57.450 INFO - Sensor InitialOpenIssuesSensor
21:46:57.472 INFO - Sensor InitialOpenIssuesSensor (done) | time=22ms
21:46:57.473 INFO - Sensor ProjectLinksSensor
21:46:57.487 INFO - Sensor ProjectLinksSensor (done) | time=14ms
21:46:57.487 INFO - Sensor VersionEventsSensor
21:46:57.518 INFO - Sensor VersionEventsSensor (done) | time=31ms
21:46:57.518 INFO - Sensor SurefireSensor
21:46:57.520 INFO - parsing /home/administrator/tmp/frameworks/av/target/surefire-reports
21:46:57.520 ERROR - Reports path not found or is not a directory: /home/administrator/tmp/frameworks/av/target/surefire-reports
21:46:57.520 INFO - Sensor SurefireSensor (done) | time=2ms
21:46:57.520 INFO - Sensor SCM Sensor
21:46:57.520 INFO - SCM provider for this project is: git
21:46:57.529 INFO - 1 files to be analyzed
21:46:57.910 INFO - 0/1 files analyzed
21:46:57.910 WARN - Missing blame information for the following files:
21:46:57.911 WARN - * /home/administrator/tmp/frameworks/av/Test.java
21:46:57.911 WARN - This may lead to missing/broken features in SonarQube
21:46:57.911 INFO - Sensor SCM Sensor (done) | time=391ms
21:46:57.911 INFO - Sensor CPD Sensor
21:46:57.911 INFO - JavaCpdEngine is used for java
21:46:57.912 INFO - Cross-project analysis disabled
21:46:57.939 INFO - Sensor CPD Sensor (done) | time=28ms
21:46:57.941 INFO - No quality gate is configured.
21:46:57.985 INFO - Compare to previous analysis (2015-07-03)
21:46:57.992 INFO - Compare over 30 days (2015-06-03, analysis of Thu Jul 02 14:53:26 CST 2015)
21:46:58.311 INFO - Execute decorators...
21:46:58.960 INFO - Store results in database
21:46:59.289 INFO - Analysis reports generated in 44ms, dir size=1 KB
21:46:59.299 INFO - Analysis reports compressed in 10ms, zip size=1 KB
21:46:59.349 INFO - Analysis reports sent to server in 50ms
21:46:59.350 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/test-platform-frameworks-av
21:46:59.350 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------