<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          SonarQube和Sonar-Scanner的安裝與使用

          共 6943字,需瀏覽 14分鐘

           ·

          2021-12-11 16:41

          一、介紹

          sonar是搞代碼質(zhì)量測試的一款開源工具。SonarQube是sonar的Web服務(wù)端,用來發(fā)布應(yīng)用和在線瀏覽(分析),sonar-scanner用于掃描源碼, 將代碼寫入數(shù)據(jù)庫之類的地方,便于sonarqube進(jìn)行分析

          二、JDK的安裝使用

          2.1、配置JDK環(huán)境變量

          以筆者的JDK安裝目錄為例,

          jdk目錄:D:\Program Files\Java\jdk1.8.0_101

          jre目錄:D:\Program Files\Java\jre1.8.0_101

          2.1.1、配置JAVA_HOME

          2.1.2、 配置PATH

          2.1.3、配置CLASSPATH

          2.1.4、驗(yàn)證是否配置成功

          三、SonarQube的安裝使用

          默認(rèn)端口:9000

          配置文件(以筆者電腦為例):sonarqube-9.2.1.49989\conf\sonar.properties

          默認(rèn)用戶名密碼:都是admin

          默認(rèn)訪問網(wǎng)址:http://ip:9000

          點(diǎn)擊StartSonar.bat, 打開樓上的默認(rèn)網(wǎng)址,輸入默認(rèn)密碼就行了。

          四、Sonar-scanner的安裝使用

          配置文件(以筆者電腦為例):sonar-scanner-4.6.2.2472-windows\conf\sonar-scanner.properties

          4.1、Sonar-Scanner環(huán)境變量配置

          4.1.1 配置SONAR_RUNNER_HOME

          4.1.2、 配置PATH

          4.2、 運(yùn)行項(xiàng)目驗(yàn)證結(jié)果

          4.2.1、配置掃描文件

          sonar.projectKey=agentsonar.projectName=agentsonar.projectVersion=4.3.0sonar.sources=.sonar.exclusions=**/public/**,**/src/locales/**sonar.sourceEncoding=UTF-8sonar.language=javascriptsonar.login=adminsonar.password=admin

          4.2.2、掃它

          在項(xiàng)目根目錄運(yùn)行命令sonar-scanner等結(jié)果即可

          PS D:\ataola\gitlab\20211207\sany-web\agent> sonar-scannerINFO: Scanner configuration file: D:\ataola\document\2021\12\sonar-scanner-4.6.2.2472-windows\bin\..\conf\sonar-scanner.propertiesINFO: Project root configuration file: D:\ataola\gitlab\20211207\sany-web\agent\sonar-project.propertiesINFO: SonarScanner 4.6.2.2472INFO: Java 11.0.11 AdoptOpenJDK (64-bit)INFO: Windows 10 10.0 amd64INFO: User cache: C:\Users\14457\.sonar\cacheINFO: Scanner configuration file: D:\ataola\document\2021\12\sonar-scanner-4.6.2.2472-windows\bin\..\conf\sonar-scanner.propertiesINFO: Project root configuration file: D:\ataola\gitlab\20211207\sany-web\agent\sonar-project.propertiesINFO: Analyzing on SonarQube server 9.2.1INFO: Default locale: "en_US", source code encoding: "UTF-8"INFO: Load global settingsINFO: Load global settings (done) | time=350msINFO: Server id: BF41A1F2-AX2PesCwEVbfPSmwmCVAINFO: User cache: C:\Users\14457\.sonar\cacheINFO: Load/download pluginsINFO: Load plugins indexINFO: Load plugins index (done) | time=275msINFO: Load/download plugins (done) | time=873msINFO: Process project propertiesINFO: Process project properties (done) | time=22msINFO: Execute project buildersINFO: Execute project builders (done) | time=2msINFO: Project key: agentINFO: Base dir: D:\ataola\gitlab\20211207\sany-web\agentINFO: Working dir: D:\ataola\gitlab\20211207\sany-web\agent\.scannerworkINFO: Load project settings for component key: 'agent'INFO: Load project settings for component key: 'agent' (done) | time=284msINFO: Load quality profilesINFO: Load quality profiles (done) | time=586msINFO: Load active rulesINFO: Load active rules (done) | time=8301msINFO: Indexing files...INFO: Project configuration:INFO:   Excluded sources: **/public/**, **/src/locales/**INFO: 327 files indexedINFO: 46 files ignored because of inclusion/exclusion patternsINFO: 4 files ignored because of scm ignore settingsINFO: Quality profile for css: Sonar wayINFO: Quality profile for js: Sonar wayINFO: Quality profile for json: Sonar wayINFO: ------------- Run sensors on module agentINFO: Load metrics repositoryINFO: Load metrics repository (done) | time=306msINFO: Sensor JaCoCo XML Report Importer [jacoco]INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xmlINFO: No report imported, no coverage information will be imported by JaCoCo XML Report ImporterINFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=38msINFO: Sensor IaC CloudFormation Sensor [iac]INFO: Load project repositoriesINFO: Load project repositories (done) | time=361msINFO: 0 source files to be analyzedINFO: 0/0 source files have been analyzedINFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=481msINFO: Sensor JavaScript analysis [javascript]INFO: 269 source files to be analyzedINFO: 2/269 files analyzed, current file: src/pages/reportManagement/product/model.jsINFO: 70/269 files analyzed, current file: config/validator.jsINFO: 124/269 files analyzed, current file: src/pages/financingAccess/model.jsINFO: 206/269 files analyzed, current file: src/pages/financingAccess/addApply/components/Step4/index.jsxINFO: 269/269 source files have been analyzedINFO: Sensor JavaScript analysis [javascript] (done) | time=118667msINFO: Sensor TypeScript analysis [javascript]INFO: No input files found for analysisINFO: Sensor TypeScript analysis [javascript] (done) | time=12msINFO: Sensor CSS Metrics [javascript]INFO: Sensor CSS Metrics [javascript] (done) | time=1086msINFO: Sensor CSS Rules [javascript]INFO: 45 source files to be analyzedINFO: 45/45 source files have been analyzedINFO: Sensor CSS Rules [javascript] (done) | time=4514msINFO: Sensor C# Project Type Information [csharp]INFO: Sensor C# Project Type Information [csharp] (done) | time=1msINFO: Sensor C# Analysis Log [csharp]INFO: Sensor C# Analysis Log [csharp] (done) | time=38msINFO: Sensor C# Properties [csharp]INFO: Sensor C# Properties [csharp] (done) | time=0msINFO: Sensor JavaXmlSensor [java]INFO: Sensor JavaXmlSensor [java] (done) | time=4msINFO: Sensor HTML [web]INFO: Sensor HTML [web] (done) | time=7msINFO: Sensor VB.NET Project Type Information [vbnet]INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=2msINFO: Sensor VB.NET Analysis Log [vbnet]INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=40msINFO: Sensor VB.NET Properties [vbnet]INFO: Sensor VB.NET Properties [vbnet] (done) | time=0msINFO: ------------- Run sensors on projectINFO: Sensor Zero Coverage SensorINFO: Sensor Zero Coverage Sensor (done) | time=217msINFO: CPD Executor 36 files had no CPD blocksINFO: CPD Executor Calculating CPD for 233 filesWARN: Too many duplication groups on file src/utils/addressCascader/industry.js. Keep only the first 100 groups.INFO: CPD Executor CPD calculation finished (done) | time=938msINFO: Analysis report generated in 711ms, dir size=5.0 MBINFO: Analysis report compressed in 17935ms, zip size=1.7 MBINFO: Analysis report uploaded in 562msINFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=agentINFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis reportINFO: More about the report processing at http://localhost:9000/api/ce/task?id=AX2enXM0eAsfd-3jKFcfINFO: Analysis total time: 2:59.463 sINFO: ------------------------------------------------------------------------INFO: EXECUTION SUCCESSINFO: ------------------------------------------------------------------------INFO: Total time: 3:02.946sINFO: Final Memory: 14M/54MINFO: ------------------------------------------------------------------------PS D:\ataola\gitlab\20211207\sany-web\agent>
           

          4.2.3、看它

          寫在最后

          這是一篇水文,我其實(shí)不太喜歡這么搞,我認(rèn)為如果團(tuán)隊(duì)Ok的話,從最開始編碼規(guī)范就定義好,加上code review,加上mocha或者jest做測試,比較有感覺一點(diǎn)。這種東西,有人喜歡搞,也有人不喜歡搞,具體的還是根據(jù)需求來,比如甲方需要那就搞唄,搞得時(shí)候也要注意安全問題啊, 頭像已經(jīng)高斯模糊, 逃。。。。。。



          瀏覽 133
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国外十八禁香蕉 | 骚五月 | 国产一区二三区免费A片惊变 | 国产在视频线精品视频www666 | 免费看A片秘 免费 |