SonarQube分析增量还是?

时间:2016-02-17 15:05:33

标签: sonarqube

我们有一个进程将签入PL / SQL存储过程更改为TFS,然后我使用Jenkins作业使用SonarQube PL / SQL插件对它们进行分析。我看到它总是索引所有文件(162)。 SonarQube Runner如何将结果更新到数据库?删除现有的并创建一个新的,或逐步更新?

Getting version 'C378149' to 'D:\public_jendevslave_1\workspace\DevOps\SonarQube-PLSQL-TFS'...
Finished getting version 'C378149'.
[SonarQube-PLSQL-TFS] $ D:\sonar-runner\sonar-runner-2.4\bin\sonar-runner.bat -e -Dsonar.jdbc.url=jdbc:postgresql://ip:5432/sonar ******** ******** -Dsonar.host.url=http://sonarqube.dev.com/ ******** ******** -Dsonar.projectBaseDir=D:\public_jendevslave_1\workspace\DevOps\SonarQube-PLSQL-TFS -Dsonar.language=plsql "-Dsonar.projectName=PL/SQL :: Schedule Snapshot 2013 :: EDBDEV" -Dsonar.projectVersion=1.0 -Dsonar.sourceEncoding=UTF-8 -Dsonar.projectKey=PLSQL.EDBDEV -Dsonar.sources=ACCT/PROCEDURE,ADMIN/PROCEDURE,ADMINDBA/PROCEDURE,DMBO/PROCEDURE,DS/PROCEDURE,EQDRV/PROCEDURE,ETL/PROCEDURE,FAME/PROCEDURE,FIQR/PROCEDURE,FIRVFO/PROCEDURE,GLOBAL/PROCEDURE,IPA/PROCEDURE,IT/PROCEDURE,MKT/PROCEDURE,MREF/PROCEDURE,OMS/SEQUENCE,PA/PROCEDURE,PA_UAT/PROCEDURE,PCONFO/PROCEDURE,PRC/PROCEDURE,REC/PROCEDURE,RISK/PROCEDURE,VREP/SEQUENCE
D:\sonar-runner\sonar-runner-2.4
SonarQube Runner 2.4
Java 1.8.0_31 Oracle Corporation (64-bit)
Windows Server 2012 R2 6.3 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: D:\sonar-runner\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: D:\public_jendevslave_1\workspace\DevOps\SonarQube-PLSQL-TFS\.sonar
INFO: SonarQube Server 5.1
14:28:24.824 INFO  - Load global repositories
14:28:25.315 INFO  - Load global repositories (done) | time=498ms
14:28:25.321 INFO  - Server id: 20160208114216
14:28:25.327 INFO  - User cache: C:\Users\svc_selfserv_dev\.sonar\cache
14:28:25.350 INFO  - Install plugins
14:28:25.826 INFO  - Install JDBC driver
14:28:25.838 INFO  - Create JDBC datasource for jdbc:postgresql://ip:5432/sonar
14:28:27.873 INFO  - Initializing Hibernate
14:28:29.618 INFO  - views plugin licensed to OTPP, EVALUATION [Expiration: 2016-02-19, Server: *]
14:28:30.213 INFO  - Load project repositories
14:28:31.117 INFO  - Load project repositories (done) | time=904ms
14:28:31.118 INFO  - Load project settings
14:28:31.937 INFO  - Load technical debt model
14:28:32.033 INFO  - Apply project exclusions
14:28:33.795 WARN  - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
14:28:33.799 INFO  - -------------  Scan PL/SQL :: Schedule Snapshot 2013 :: EDBDEV
14:28:33.832 INFO  - Load module settings
14:28:34.298 INFO  - Language is forced to plsql
14:28:34.324 INFO  - Load rules
14:28:34.945 INFO  - Base dir: D:\public_jendevslave_1\workspace\DevOps\SonarQube-PLSQL-TFS
14:28:34.946 INFO  - Working dir: D:\public_jendevslave_1\workspace\DevOps\SonarQube-PLSQL-TFS\.sonar
14:28:34.958 INFO  - Source paths: ACCT/PROCEDURE, ADMIN/PROCEDURE, ADMINDBA/PROCEDURE, DMBO/PROCEDURE, DS/PROCEDURE, EQDRV/PROCEDURE, ETL/PROCEDURE, FAME/PROCEDURE, FIQR/PROCEDURE, FIRVFO/PROCEDURE, GLOBAL/PROCEDURE, IPA/PROCEDURE, IT/PROCEDURE, MKT/PROCEDURE, MREF/PROCEDURE, OMS/SEQUENCE, PA/PROCEDURE, PA_UAT/PROCEDURE, PCONFO/PROCEDURE, PRC/PROCEDURE, REC/PROCEDURE, RISK/PROCEDURE, VREP/SEQUENCE
14:28:34.959 INFO  - Source encoding: UTF-8, default locale: en_US
14:28:34.959 INFO  - Index files
14:28:35.274 INFO  - 162 files indexed
14:28:37.459 INFO  - Quality profile for plsql: Sonar way
14:28:38.372 INFO  - JIRA issues sensor will not run as some parameters are missing.
14:28:38.409 INFO  - plsql EVALUATION [Expiration: 2016-02-19, Server: *]
14:28:38.410 INFO  - Sensor Lines Sensor
14:28:38.528 INFO  - Sensor Lines Sensor (done) | time=118ms
14:28:38.529 INFO  - Sensor QProfileSensor
14:28:38.536 INFO  - Sensor QProfileSensor (done) | time=7ms
14:28:38.536 INFO  - Sensor InitialOpenIssuesSensor
14:28:39.221 INFO  - Sensor InitialOpenIssuesSensor (done) | time=685ms
14:28:39.222 INFO  - Sensor ProjectLinksSensor
14:28:39.236 INFO  - Sensor ProjectLinksSensor (done) | time=14ms
14:28:39.236 INFO  - Sensor VersionEventsSensor
14:28:39.255 INFO  - Sensor VersionEventsSensor (done) | time=19ms
14:28:39.255 INFO  - Sensor com.sonar.plsql.plugin.K@4526b3d5
14:28:39.319 INFO  - 162 source files to be analyzed
14:28:39.823 WARN  - 
14:28:39.824 WARN  - Unable to fully parse: D:\public_jendevslave_1\workspace\DevOps\SonarQube-PLSQL-TFS\ADMIN\PROCEDURE\WINDOWS_MONITOR_FILE_SYS.prc
14:28:39.824 WARN  - Parse error starting from line 1
14:28:39.824 WARN  - 
14:28:41.390 INFO  - Sensor com.sonar.plsql.plugin.K@4526b3d5 (done) | time=2135ms
14:28:41.390 INFO  - Sensor SCM Sensor
14:28:41.391 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
14:28:41.391 INFO  - Sensor SCM Sensor (done) | time=1ms
14:28:41.391 INFO  - Sensor CPD Sensor
14:28:41.391 INFO  - DefaultCpdEngine is used for plsql
14:28:41.392 INFO  - Cross-project analysis enabled
14:28:41.399 INFO  - 162/162 source files have been analyzed
14:28:46.099 INFO  - Sensor CPD Sensor (done) | time=4708ms
14:28:46.101 INFO  - No quality gate is configured.
14:28:46.194 INFO  - Compare to previous analysis (2016-02-08)
14:28:46.206 INFO  - Compare over 30 days (2016-01-09, analysis of Thu Feb 04 16:28:50 EST 2016)
14:28:46.764 INFO  - Execute decorators...
14:28:50.496 INFO  - Store results in database
14:28:55.612 INFO  - Analysis reports generated in 1041ms, dir size=1016 KB
14:28:58.352 INFO  - Analysis reports compressed in 2738ms, zip size=360 KB
14:28:58.605 INFO  - Analysis reports sent to server in 253ms
14:28:58.605 INFO  - ANALYSIS SUCCESSFUL, you can browse http://sonarqube.dev/dashboard/index/PLSQL.EDBDEV
14:28:58.605 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: ------------------------------------------------------------------------
Total time: 35.693s
Final Memory: 20M/621M
INFO: ------------------------------------------------------------------------
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in  1 second
Finished: SUCCESS

2 个答案:

答案 0 :(得分:1)

如果update the result表示update the Issues,则this page会解释用于确定问题是否为新问题的算法。

在任何情况下,扫描所有文件都是正常的。检查整个项目代码库以及项目的代码/问题/措施/等。在数据库中更新。

答案 1 :(得分:0)

当运行新分析时,SonarQube会清除以前结果的部分内容,请参阅 History and Events - SonarQube Documentation - SonarQube

  

当您对项目进行新的分析时,以前可用的一些数据将从数据库中清除。例如,在新分析结束时,将自动删除先前分析的源代码,目录和文件级别的度量等。此外,还删除了一些旧的分析快照   [...]

     

为了节省空间并提高整体性能,Database Cleaner会删除数据库中的某些行。这是默认配置:

     
      
  • 每个项目:      
        
    • 1天后每天只保留一张快照。标记为事件的快照不会被删除。
    •   
    • 1个月后每周只保留一张快照。标记为事件的快照不会被删除。
    •   
    • 1年后每月只保留一个快照。标记为事件的快照不会被删除。
    •   
    • 删除所有超过5年的快照,包括由事件标记的快照。
    •   
  •   
  • 删除超过30天的所有已结算问题
  •   
  • 不保留包/目录级别的历史记录
  •   
     

可以在设置>中更改这些设置。一般设置>一般>数据库清理工具。

如果您担心运行分析的性能,或者您想知道所有分析是否持久(或不稳定),请记住在您发布的日志中你已经进行了完整的分析(默认) 总的来说,SonarQube可以执行三种类型的分析:

  • 完整分析。这是默认设置,分析所有文件,并在数据库中保留所有新快照。旧快照不会被删除,但是,如文档中所述(如上所述),将删除引用previos版本的源代码文件。
  • 预览分析。这被描述为完整分析,除了它不将结果存储在数据库中。结果显示在控制台上或作为html文件存储在本地。我在运行此模式(SonarQube 6.1)时看到的是它对所有文件进行索引,但随后检测到已更改的文件并最终运行更快的分析(我们可以假设它重用旧的分析没有改变的文件)。它检查规则,但没有计算出指标。
  • 增量即可。这是一个有点误导性的术语。它是可用于IDE(Eclipse,IDEA,Visual Studio以及命令行工具)的插件SonarLint使用的设置,它将分析限制为开发人员已更改的文件。与后者一样,它仅检查规则(无指标)。这是他们有时称之为" pre-commit"分析,我相信它只是分析尚未提交的文件(为此,它会查询开发人员在本地安装的SCM,Git或SVN)。我还怀疑它无法在两次任意提交之间进行分析。

最后,控制此行为的参数为sonar.analysis.mode,并且您的声纳版本(5.1)分别对应值analysispreviewincremental,在新版本(5.3+)中,它必须设置为publishpreview(还有issues但我不确定它的作用,因为它们看起来有点含糊不清只需说明" 是一个等同于工具使用的预览版本。您永远不需要手动使用它&#34 ;;请参阅{{3} })