SonarQube (4) 運行一個Sample

SonarQube系列 目錄


拉取sonar-cxx插件源代碼

$ git clone https://github.com/SonarOpenCommunity/sonar-cxx.git

其中,sample代碼位于/sonar-cxx/sonar-cxx-plugin/src/samples/SampleProject2

$ cd /sonar-cxx/sonar-cxx-plugin/src/samples/SampleProject2

運行sonar-runner

$ sonar-runner

得到結果EXECUTION SUCCESS,運行成功

SonarQube Runner 2.4
Java 1.8.0_121 Oracle Corporation (64-bit)
Linux 3.10.0-514.6.2.el7.x86_64 amd64
INFO: Runner configuration file: /etc/sonar-runner-2.4/conf/sonar-runner.properties
INFO: Project configuration file: /root/sonar-sample/sonar-cxx/sonar-cxx-plugin/src/samples/SampleProject2/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Work directory: /root/sonar-sample/sonar-cxx/sonar-cxx-plugin/src/samples/SampleProject2/./.sonar
INFO: SonarQube Server 5.6.7
04:45:31.997 INFO  - Load global repositories
...
...
04:45:34.852 INFO  - Analysis report uploaded in 41ms
04:45:34.852 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/CxxPlugin:Sample
04:45:34.852 INFO  - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
04:45:34.853 INFO  - More about the report processing at http://localhost:9000/api/ce/task?id=AV69XOLms3rpTnB5rfdL
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 3.441s
Final Memory: 9M/220M
INFO: ------------------------------------------------------------------------

登錄頁面查看分析結果

復制根據分析結果中的url

04:45:34.852 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/CxxPlugin:Sample

在瀏覽器中打開

http://localhost:9000/dashboard/index/CxxPlugin:Sample

代碼分析結果展示

Sonar result

代碼問題列表

Code smell

參考

https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Running-the-analysis

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容