sonarqube

Sonarqube test report “report refers to a file which is not configured as a test file” when tests and source are together

╄→гoц情女王★ 提交于 2020-04-13 09:11:16
问题 I am using TypeScript and Jest and have my tests next to my source files. e.g: someDir someCode.ts someCode.spec.ts When I try and import the text-report.xml (which looks to be fine and matches the format), I get an error saying: 'Line X report refers to a file which is not configured as a test file: /someDir/someCode.spec.ts' What configuration do I need in in the Sonarqube properties so that it understand which files are tests and which are source? 回答1: Seems it doesn't detect files in sub

Sonarqube test report “report refers to a file which is not configured as a test file” when tests and source are together

烂漫一生 提交于 2020-04-13 09:09:50
问题 I am using TypeScript and Jest and have my tests next to my source files. e.g: someDir someCode.ts someCode.spec.ts When I try and import the text-report.xml (which looks to be fine and matches the format), I get an error saying: 'Line X report refers to a file which is not configured as a test file: /someDir/someCode.spec.ts' What configuration do I need in in the Sonarqube properties so that it understand which files are tests and which are source? 回答1: Seems it doesn't detect files in sub

Gradle这篇文章就够用了11-Gradle与CI/CD插件集成

倾然丶 夕夏残阳落幕 提交于 2020-04-06 17:59:56
Gradle与CI/CD插件集成 结合JUnit进行单体测试 在build.gradle中添加testImplementation,例如 buildscript { ext { springBootVersion = '2.1.1.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' group = 'com.orrincn' version = '0.0.1-SNAPSHOT' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { implementation('org.springframework.boot:spring-boot-starter-web') testImplementation('org

持续集成之代码质量管理———Sonar

夙愿已清 提交于 2020-03-25 15:42:16
Sonar是一个用于代码质量管理的开放平台,通过插件机制,Sonar可以集成不同的测试工具、代码分析工具以及持续集成工具。与持续集成工具(如Hudson/Jenkins等)不同,Sonar并不是简单地把不同代码检查结果(例如:FindBugs、PMD等)直接显示在web UI界面上,而是通过不同的插件对这些结果再加工处理,通过量化的方式度量代码质量的变化,从而可以方便地对不同规模和种类的工程进行代码质量管理。 在对其他工具的支持方面,Sonar 不仅提供了对 IDE 的支持,可以在 Eclipse 和 IntelliJ IDEA 这些工具里联机查看结果;同时 Sonar 还对大量的持续集成工具提供了接口支持,可以很方便地在持续集成中使用 Sonar。 此外,Sonar 的插件还可以对 Java 以外的其他编程语言提供支持,对国际化以及报告文档化也有较好的支持。 Sonar 的功能就是来检查代码是否有 BUG。除了检查代码是否有 bug 还有其他的功能,比如说:你的代码注释率是多少,代码有一些建议,编写语法的建议。所以称之为质量管理。 一、部署Sonar 接下来的配置是基于博文 部署Jenkins+Gitlab实现持续集成 的环境进行部署 所有的源码包及插件都可以在此 链接 (提取码: t976)下载 [root@jenkins ~]# unzip sonarqube-5.6.zip

SonarQube ignore getter/setters in code analysis

断了今生、忘了曾经 提交于 2020-03-18 17:50:09
问题 Is there a setting in SonarQube dashboard that allows for ignoring getter and setters? This sounds like a better option then coding //nopmd on every method in your codebase. My codebase has a lot of them and they are dramatically lowering my unit test coverage % being reported in the Sonarqube dashboard 回答1: There is no option to ignore getters and setters. However, if you have classes you'd like omitted entirely from coverage calculations, you can easily do so with exclusions. 来源: https:/

SonarQube ignore getter/setters in code analysis

廉价感情. 提交于 2020-03-18 17:48:41
问题 Is there a setting in SonarQube dashboard that allows for ignoring getter and setters? This sounds like a better option then coding //nopmd on every method in your codebase. My codebase has a lot of them and they are dramatically lowering my unit test coverage % being reported in the Sonarqube dashboard 回答1: There is no option to ignore getters and setters. However, if you have classes you'd like omitted entirely from coverage calculations, you can easily do so with exclusions. 来源: https:/

SonarQube REST APIs : Read Metrics for individual projects

梦想的初衷 提交于 2020-03-17 11:24:11
问题 My question: I am using SonarQube version 7.1 and trying to extract the metrics and quality gate related to individual projects. What we have tried We were using Python SonarQube API to extract these data before our company upgraded to version 7.1. "api/resources" web service Deprecated since sonarqube5.4, so we cannot use it anymore. I have also tried using getting data using CURL command via Web API using curl -i -H "Content-Type: application/json" -H "x-api-key:token" -X GET 'http://MY

java.lang.IllegalStateException: Not a JSON Object

自古美人都是妖i 提交于 2020-03-17 11:13:08
问题 I am trying to get a json response from SonarQube using the SonarQube web API. While assigning the JsonElement into a JsonObject I am getting this error: java.lang.IllegalStateException: Not a JSON Object This is my Java class @Controller public class SonarController { @Autowired JenkinsDataService jenkinsService; @Autowired SonarDataService sonarService; HttpEntity<String> entity; @RequestMapping(value = { "/sonar" }) public void test(HttpServletRequest request, HttpServletResponse response

java.lang.IllegalStateException: Not a JSON Object

北城以北 提交于 2020-03-17 11:13:05
问题 I am trying to get a json response from SonarQube using the SonarQube web API. While assigning the JsonElement into a JsonObject I am getting this error: java.lang.IllegalStateException: Not a JSON Object This is my Java class @Controller public class SonarController { @Autowired JenkinsDataService jenkinsService; @Autowired SonarDataService sonarService; HttpEntity<String> entity; @RequestMapping(value = { "/sonar" }) public void test(HttpServletRequest request, HttpServletResponse response

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

别来无恙 提交于 2020-03-14 13:23:33
问题 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