sonarqube

Is there a way to ignore Sonar issue “common-java:InsufficientCommentDensity” for whole project?

半世苍凉 提交于 2020-03-14 13:23:30
问题 I'm working on the project, where the developers are trying to write understandable code, so there is no sense to use comments in a lot of places. We have a SonarQube, which is used in other projects and we cannot configure it. All we can do is configuring Sonar in our project's POM file. SonarQube is complaining, that there are not comments in our code with the rule "common-java:InsufficientCommentDensity" . I know, that we can ignore some rules using sonar.issue.ignore.multicriteria

Is there a way to ignore Sonar issue “common-java:InsufficientCommentDensity” for whole project?

孤街浪徒 提交于 2020-03-14 13:22:08
问题 I'm working on the project, where the developers are trying to write understandable code, so there is no sense to use comments in a lot of places. We have a SonarQube, which is used in other projects and we cannot configure it. All we can do is configuring Sonar in our project's POM file. SonarQube is complaining, that there are not comments in our code with the rule "common-java:InsufficientCommentDensity" . I know, that we can ignore some rules using sonar.issue.ignore.multicriteria

sonarqube配置全指南,集成阿里巴巴p3c规范

夙愿已清 提交于 2020-03-12 12:32:27
环境准备 内置数据库 Sonar安装成功后,默认内置H2数据库,用于记录单次的扫描结果,对同一个project重复扫码,会覆盖之前的扫描记录,所以H2 数据库只应用于测试,不可以用于生产环境,那如果你是想玩玩,不想长期扫描你的项目,可以不必配置数据库 自定义数据库: Oracle SQL Server(只支持SQL Server 2014 以及 SQL Server2016) PostgreSQL MYSQL 版本限制: 8.0>MYSQL>=5.6 (注官方说明,从Sonar7.9版本,不再支持Mysql),以下链接 End of Life of MySQL Support : SonarQube 7.9 and future versions do not support MySQL. Please migrate to a supported database. Get more details at https://community.sonarsource.com/t/end-of-life-of-mysql-support https://jira.sonarsource.com/browse/SONAR-11963 安装步骤 1.安装sonarqube: 安装的是windows 7.4 community社区版 https://binaries.sonarsource

docker-compose 搭建 sonarqube8.2 + postgresql12

你离开我真会死。 提交于 2020-03-11 12:48:33
废话不多说上代码 version : '3' services : postgres : image : postgres : 12 restart : always container_name : postgres ports : - 5432 : 5432 volumes : - /opt/postgres/postgresql/ : /var/lib/postgresql - /opt/postgres/data/ : /var/lib/postgresql/data environment : TZ : Asia/Shanghai POSTGRES_USER : sonar POSTGRES_PASSWORD : sonar123 POSTGRES_DB : sonar networks : - sonar - network sonar : image : sonarqube : 8.2 - community restart : always container_name : sonar depends_on : - postgres volumes : - /opt/sonarqube/extensions : /opt/sonarqube/extensions - /opt/sonarqube/logs : /opt/sonarqube/logs - /opt

SonarQube代码质量管理平台安装与配置

▼魔方 西西 提交于 2020-03-06 18:07:49
1.安装说明 PS:为什么要有安装说明?江边望海在网上找资料的时候发现很多教程是没有交代清楚安装环境的。所以,不清楚他们的教程是否适合我的环境。明确『安装说明』方便网友了解我的配置环境,便于大家深入理解此教程。 虚拟机:VirtualBox4.3.26 操作用户:root 系统环境:centos6.6-x86_64(最小化安装) 软件下载目录:/root/opt ================ 2.预置条件 1.需要JDK1.6+支持;(如果不知道如何安装JDK,请访问我写的《 Centos下安装JDK 》) 2.需要Mysql数据库支持;(虽然SonarQube自带了H2数据库,但是为了方便管理数据推荐使用Mysql数据库) 多说一句:JDK是必须安装的,Mysql数据库并不是必须要安装的,如果公司有Mysql服务器,直接拿来使用就行,江边望海这次就没有安装Mysql直接用公司内网提供的Mysql数据库。 ================ 3.安装 在安装之前,介绍一下SonarQube和SonarQube Runner之间的关系。 SonarQube是服务器端,它主要有两个功能:1.分析源代码;2.因为它内嵌了Apache模块,所以提供Web端的界面访问。 SonarQube Runner是一个利用SonarQube服务端分析代码的命令行工具,可以把它简单理解为客户端。

sonarqube不再支持jacoco coverage非xml格式的报告, 只通过sonar.coverage.jacoco.reportXmlPaths支持xml

拜拜、爱过 提交于 2020-03-06 17:22:06
jacoco是一个开源的,目前使用比较普遍的java语言的覆盖率计算工具,它默认生成的是.exec格式的覆盖率报告。sonarqube是做代码静态扫描的平台,它可以将jacoco计算的覆盖率上传到自己的平台上,然后根据指定的规则来做一些分析。sonarqube最新的8.x的版本开始不支持.exec这种格式的报告了(也就是参数sonar.jacoco.reportPaths是不支持的了),jacoco要生成xml格式的报告才能被sonarqube识别(sonar.coverage.jacoco.reportXmlPaths)。 官方文档的说明, https://docs.sonarqube.org/pages/viewpage.action?pageId=1442166 但文档并没有说具体从哪个版本不支持。 一、首先来看如何适应sonarqube的改动 下面来看如何让jacoco生成xml格式的报告,其实很简单,在build.gradle中添加这样一个设置就好了,打开xml格式,关闭csv和html格式。 jacocoTestReport { reports { xml.enabled true csv.enabled false html.enabled false } } 然后在执行的时候把这个task添加到参数里才可以 ./graldew jacocoTestReport

Jenkins + Sonar: ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: Project does not pass the quality gate

北城余情 提交于 2020-03-05 11:43:13
问题 I am trying to integrate Sonar in Jenkins. Due to some bad code quality - it is giving below error. "ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: Project does not pass the quality gate." I do not have permission to change the quality gate right now. I want to make the build success irrespective of quality gate result. How to do it? 回答1: Seems that you have installed https://github.com/SonarQubeCommunity/sonar-build-breaker So either uninstall it, either try

Sonar cannot be access via istio virtual service but can be locally accessed after port forwarding

血红的双手。 提交于 2020-03-04 23:29:10
问题 I am trying to implement SonarQube in a Kubernetes cluster. The deployment is running properly and is also exposed via a Virtual Service. I am able to open the UI via the localhost:port/sonar but I am not able to access it through my external ip. I understand that sonar binds to localhost and does not allow access from outside the remote server. I am running this on GKE with a MYSQL database. Here is my YAML file: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: sonarqube

Sonar cannot be access via istio virtual service but can be locally accessed after port forwarding

只谈情不闲聊 提交于 2020-03-04 23:29:05
问题 I am trying to implement SonarQube in a Kubernetes cluster. The deployment is running properly and is also exposed via a Virtual Service. I am able to open the UI via the localhost:port/sonar but I am not able to access it through my external ip. I understand that sonar binds to localhost and does not allow access from outside the remote server. I am running this on GKE with a MYSQL database. Here is my YAML file: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: sonarqube

SonarQube:代码静态检查

萝らか妹 提交于 2020-02-26 11:57:13
一、介绍 SonarQube是一个用于代码质量管理的开源平台,用于管理源代码的质量通过插件形式; 可支持包括java,C#,C/C++,PL/SQL,Cobol,JavaScrip,Groovy等等二十几种编程语言的代码质量管理与检测;SonarQube官网: https://www.sonarqube.org/ Sonar是从七个维度检测代码质量,而作为开发人员至少需要处理前5中代码质量问题。 1、不遵循代码标准 sonar可以通过PMD,CheckStyle,Findbugs等代码规则检测工具规范代码编写 2、潜在的缺陷 sonar可以通过PMD,CheckStyle,Findbugs等代码规则检测工具检测出潜在的缺陷 3、糟糕的复杂度分布 文件、类、方法等,如果复杂度过高将难以改变,这会使得开发人员难以理解它们,且没有自动化的单元测试,对于程序中的任何组件的改变都将可能导致需要全面的回归测试 4、重复 显然程序中包含大量复制粘贴的代码是质量低下的,sonar可以展示源码中重复严重的地方 5、注释不足或者过多 没有注释将使代码可读性变差,特别是当不可避免出现人员变动时,程序的可读性大幅度下降,而过多的注释又会使得开发人员将奖励过多的花费在阅读注释上,亦违背初衷 6、缺乏单元测试 sonar可以很方便地统计并展示单元测试覆盖率 7、糟糕的设计 通过sonar可以找出循环