2016-02-17 63 views
0

我們有一個檢查PL/SQL存儲過程更改爲TFS的過程,然後使用Jenkins作業使用SonarQube PL/SQL插件分析它們。我發現它總是索引所有文件(162)。 SonarQube Runner如何將結果更新到數據庫?刪除現有的並創建一個新的,或增量更新?是SonarQube分析增量還是?

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 [email protected] 
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 [email protected] (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 

回答

1

如果update the result你的意思是update the Issues然後this page解釋來確定問題是否是新的或沒有的算法。

在任何情況下,掃描所有文件是正常的。整個項目的代碼庫被檢查和項目的代碼/問題/措施/等等。在數據庫中更新。

0

當一個運行一個新的分析,SonarQube清除以前的結果的一部分,看到 History and Events - SonarQube Documentation - SonarQube

當你運行你的項目的一個新的分析,一些數據,這在以前可被清理出來的數據庫。例如,在新分析結束時,以前的分析的源代碼,目錄和文件級別的度量等將自動刪除。另外,一些老分析快照也將被刪除 [...]

爲了節省空間,提高整體性能,數據庫清理刪除數據庫中的某些行。下面是它的默認配置:

  • 對於每一個項目:
    • 只有一個每天快照保持後1天。由事件標記的快照不會被刪除。
    • 1個月後每週只保留一張快照。由事件標記的快照不會被刪除。
    • 1年後每個月只保留一張快照。由事件標記的快照不會被刪除。
    • 刪除所有5歲以上的快照,包括由事件標記的快照。
  • 所有已解決的問題老在包被刪除
  • 歷史超過30天/目錄水平不能保持

這些設置可以在設置被改變>常規設置>常規>數據庫清理。

如果您是通過運行分析的性能當事人或者如果所有分析工作是你想知道堅持(或波動)請記住,在日誌中,你發佈你運行一個完整的分析(默認)。
總體而言,有三種類型的分析是SonarQube可以執行:

  • 全面分析。這是默認設置,分析所有文件,並將所有新快照保留在數據庫中。舊快照不會被刪除,但正如文檔(上面提到的)所述,刪除了引用previos版本的源代碼文件。
  • 預覽分析。這被描述爲一個完整的分析,除非它不將結果存儲在數據庫中。結果顯示在控制檯上或作爲html文件本地存儲。我運行該模式(SonarQube 6.1)時看到的是,它索引了所有文件,但隨後檢測到已更改的文件並最終運行更快的分析(我們可以假設它重新使用舊分析以查找未更改的文件)。它檢查規則,但沒有計算出指標。
  • 增量。這是一個有點誤導的術語。這是插件SonarLint使用的設置(Eclipse,IDEA,Visual Studio以及命令行工具),它將分析限制爲開發人員已更改的文件。像後者一樣,它只檢查規則(沒有度量標準)。這就是他們有時稱之爲「預先提交」的分析,我相信它只是分析尚未提交的文件(這樣做,它會查詢開發人員本地安裝的SCM,Git或SVN)。我也懷疑它不能執行兩個任意提交之間的分析。

最後,控制這種行爲的參數sonar.analysis.mode並在聲納(5.1)的版本,分別對應值analysispreview,並incremental,而在新版本(5.3+)必須設置爲publishpreview(也有issues,但我不確定它是什麼,因爲它們看起來有點模糊,只是告訴「是一個'預覽'等同於供工具使用的等價物,並且您不應該使用它手動「;參見Analyzing Source Code - SonarQube-5.3