sonarqube

Centos 7环境安装SonarQube和SonarQube Runner

﹥>﹥吖頭↗ 提交于 2020-01-20 00:06:30
SonarQube简介 Sonar 是一个用于代码质量管理的开放平台。通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具。比如pmd-cpd、checkstyle、findbugs、Jenkins。通过不同的插件对这些结果进行再加工处理,通过量化的方式度量代码质量的变化,从而可以方便地对不同规模和种类的工程进行代码质量管理。同时 Sonar 还对大量的持续集成工具提供了接口支持,可以很方便地在持续集成中使用 Sonar。 此外,Sonar 的插件还可以对 Java 以外的其他编程语言(支持的语言包括:Java、PHP、C#、C、Cobol、PL/SQL、Flex等)提供支持,对国际化以及报告文档化也有良好的支持。可以说Sonar是目前最强大的代码质量管理工具之一。 下面就来揭开Sonar的神秘面纱,看看如何在Centos环境上安装Sonar。 安装环境 系统环境:centos7.0 -x86_64(最小化安装) 前置条件:jdk1.8 , mysql-5.6 软件下载目录:/usr/local/ 软件安装目录:/usr/local/ 软件版本:sonarqube-6.7,sonar-runner-dist-2.4 sonar-scanner-3.0.3.778 sonarqube下载地址: http://www.sonarqube.org

持续集成与自动化部署 - jenkins与sonar、gitlab集成 (六)

☆樱花仙子☆ 提交于 2020-01-20 00:06:25
1 将jenkins和sonar集成 1.1 安装sonar 插件 jenkins上安装sonarqube plugin ,如果没有就安装sonarqube scanner for jenkins这个插件。 1.2 关联sonar 插件 1.2.1 系统设置 设置sonar地址 系统管理 > 系统设置 > Add SonarQube > sonarqube servers 修改如下: 1.2.2 全局设置 设置sonar扫描器位置 系统管理 > Global Tool Configuration > SonarQube Scanner > 新增 SonarQube Scanner 1.2.3 关联项目 选择一个项目 ,配置 > 构建 > Execute SonarQube Scanner >Analysis properties 填写相关参数,保存即可。 sonar.projectKey=demo sonar.projectName=demo sonar.projectVersion=1.0 sonar.sources=/server/tools/sonar-examples-4.5/projects/languages/php/php-sonar-runner-unit-tests sonar.language=php sonar.sourceEncoding=UTF-8

sonarqube官方文档翻译之UserGuide

拥有回忆 提交于 2020-01-20 00:01:45
今天继续学习使用SonarQube分析项目代码,为了便于理解,将官方手册用到的翻译出来。 UserGuide Quality Gate Use the Best Quality Gate Configuration 推荐默认配置,对于每一个版本,我们都会根据SonarQube的能力调整默认质量门(Quality Gate)。SonarQube6.2版本新增了三个度量,可靠比,安全比,可维护性比。极力推荐这些新的度量作为默认质量检查的一部分。 注意质量门的条件,必须使用不同的值。举例说明,对于检查绝对数量值没有意义,如:代码行数大于1000. Quality Gate Status 在Project页面上方会显示质量门现有的状态。 若质量门显示状态为“Fails”,你可以注意到是哪些地方出了问题,也可以为你的其他感兴趣的项目提交新的质量门状态。 Security 质量门可以被任何用户访问。若想要改变质量门配置,必须获得管理员允许。项目管理员可以选择哪个项目和哪个质量门关联。 Define Quality Gate 每个质量门条件是有以下部分组合: 度量(measure) 时间(period):值(对于时间)或漏洞(不同值) 比较操作符 警告值(可选) 错误值(可选) 例如,条件组合可能为: measure:Blocker issue period:Value comparison

MsbuildSonar Runner +Fxcop - No fxcop issues are posted to server.SonarDashBoard shows 0 technical debt

情到浓时终转凉″ 提交于 2020-01-17 03:41:06
问题 I am using Sonarqube 5.1 with MsBuildSonarRunner for my c#.net project analysis. Sonarqube 5.1 has come with C# 4.1 plugin, Recently I upgraded to 4.2. I have created a quality profile with ONLY Fxcop rules . I have followed the steps mentioned in Sonar site for analysis. In analysis, I see that FXcop rule violations are captured. But when I browse to SonarDash board, It shows technical debt as 0 and issues as 0. I have reviewed my steps many times and I don't see any mistakes from my side.

How to find 'active' snapshots that cause sonarqube upgrade to 5.0 to fail?

Deadly 提交于 2020-01-16 18:34:15
问题 I’m getting the same error as Julien Lancelot answered re: Failed to upgrade SonarQube from 4.5 to 5.0.1 ie 2015.02.18 14:56:26 INFO web[DbMigration] == PopulateProjectsUuidColumns: migrating ==================================== 2015.02.18 14:56:43 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.server.db.migrations.v50.PopulateProjectsUuidColum nsMigration org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang

两款静态代码检测工具的对比

非 Y 不嫁゛ 提交于 2020-01-16 13:22:00
测试背景 使用工具: 源伞科技Pinpoint Sonarqube 测试项目: 开源国产CMS软件iBase4J(6000行代码) 测试结果汇总 数据统计: SonarQube结果: 代码错误 安全隐患 风格质量 总量 有效/总量 2/6 4/4 0/93 6/103 源伞科技Pinpoint结果: 代码错误 安全隐患 风格质量 总量 有效/总量 2/2 19/19 6/7 27/28 我们将所有bug归为以下3类: 分类 Sonarqube对应分类 Pinpoint对应分类 代码错误 bug类 代码崩溃、数值处理不当类 安全隐患 Vulnerability类 代码安全类 风格质量 Code Smell类 代码风格、性能问题类 有效报告 :我们定义有效报告为真实影响程序执行并值得进一步检查修复的问题报告。 测试细节: 数量: 从数量看,Pinpoint结果确实明显少于SonarQube。但是有效报告明显少于Pinpoint. 安全隐患: 从质量看,首先Pinpoint可以找到很多SonarQube无法发现的Vulnerability,也就是安全隐患(19比4),其中SonarQube找到的4个有效报告Pinpoint也能找到,Pinpoint找到15个SonarQube没有找到的问题。 SonarQube的3个报告属于同一类别,是在exception.printStackTrace

SonarQube: embedded elasticsearch configuration location

假装没事ソ 提交于 2020-01-16 09:04:12
问题 I'm trying to run SonarQube on a server with ~2TB disk space, and only ~50G free space. When trying to use docker as in the official manual (nothing special), elasticsearch fails with a message about the read-only index. As far as I can get, this happens because it hits the flood_stage watermark, which is set to 95% by default. I'm pretty sure that we can set this watermark (and all others) to non-percentage smaller values, but I can't seem to find the configuration file, which the embedded

Sonar to display results generated by FxCop

半世苍凉 提交于 2020-01-15 15:36:41
问题 How can I use Sonar to display results of the output produced by FxCop. I used FxCop to run static code analysis on .NET Project and FxCop generate the result report in an XML format. Can I use Sonar to take this XML file an input and display the output with it? How can this be done? I am looking for an open source dash board tool to present the output the result produced by FxCop to the end user. 回答1: Sonar has a C# plug-in, documented here: http://docs.codehaus.org/display/SONAR/C-Sharp

Sonar to display results generated by FxCop

眉间皱痕 提交于 2020-01-15 15:36:12
问题 How can I use Sonar to display results of the output produced by FxCop. I used FxCop to run static code analysis on .NET Project and FxCop generate the result report in an XML format. Can I use Sonar to take this XML file an input and display the output with it? How can this be done? I am looking for an open source dash board tool to present the output the result produced by FxCop to the end user. 回答1: Sonar has a C# plug-in, documented here: http://docs.codehaus.org/display/SONAR/C-Sharp

Sonar -LOC & Cyclomatic complexity

送分小仙女□ 提交于 2020-01-15 09:28:46
问题 How does Sonar calculates software metrics particularly LOC and cyclomatic complexity? Does it uses any particular tools? IF yes, please also give the names. 回答1: For each supported language, a "squid" plugin is used to parse the source code and determine some base metrics such as LOC and complexity. How the complexity is calculated varies based on the plugin. For example, here's the source code files for the JavaScript plugin: https://github.com/SonarCommunity/sonar-javascript/tree/master