Skip to main content

Questions tagged [sonarcloud]

SonarCloud is the code quality cloud service provided by SonarSource.

sonarcloud
Filter by
Sorted by
Tagged with
23 votes
4 answers
17k views

How to add SonarCloud badge on GitHub?

I am trying to add SonarCloud badge to my README. But when I do like this ![https://sonarcloud.io/dashboard?id=com.lapots.breed.judge%3Ajudge-rule-engine](https://sonarcloud.io/api/project_badges/...
lapots's user avatar
  • 13.2k
20 votes
2 answers
9k views

How to configure Source code analysis for Monorepo?

I have a Mono repo in which all my Spring boot based micro service reside. I know how to configure a SonarQube analysis for poly repo but wondering how sonarqube analysis can be done on a monorepo ...
Spencer Bharath's user avatar
18 votes
2 answers
23k views

Change main branch in Sonarqube without deleting branch

I am trying to change my main branch in Sonarqube from master to mainline as I have been doing my analysis on mainline for the past few months. This post below in the Sonar community says that I have ...
Zach's user avatar
  • 213
14 votes
3 answers
13k views

Is there a possibility to suppress warnings of sonarcloud in source code?

I am facing an issue with some sonarcloud warnings that will not be fixed in the nearest future (and should be disabled for now). The warnings are raised by sonarcloud during build on CI. There are no ...
zds's user avatar
  • 934
10 votes
2 answers
23k views

How to configure SonarCloud

I have java project and I want to integrate it with SonarCloud I Follow the official steps: Inspecting code with the SonarQube Scanner # Before inspecting your code, you need to: ...
Xelian's user avatar
  • 17k
8 votes
2 answers
12k views

Not getting code coverage in SonarCloud from an Azure Devops .NET core build

I have set up a pipeline for my .NET Core project in Azure Devops using the '.NET Core with SonarCloud' template. When I build the analysis gets run in SonarCloud but with 0% Code coverage (I have ...
Tracey Penberthy's user avatar
8 votes
4 answers
7k views

Is it possible to customise rules for SonarCloud (not SonarQube)

I'm wondering if it is possible to add a custom rule or modify an existing rule - as mentioned in https://docs.sonarqube.org/display/DEV/Adding+Coding+Rules - to our SonarCloud instance. We've setup ...
Juan van den Anker's user avatar
8 votes
1 answer
4k views

SonarCloud error on Travis: Not authorized. Please check the properties sonar.login and sonar.password

I have search a lot about this problem also here on stackoverflow, but I didn't find the solution. Until yesterday Travis could execute sonar:sonar without any problem, but today it doesn't work and ...
Lulixter's user avatar
  • 191
8 votes
2 answers
8k views

Travis CI SonarCloud error "Project was never analyzed. A regular analysis is required before a branch analysis"

Hi I am automating code coverage on SonarCloud using Travis CI for a Maven application. Now, running the sonar:sonar command locally submits the report on SoundCloud and I can see it as shown below ...
Meena Chaudhary's user avatar
7 votes
1 answer
7k views

Code and details of code coverage not showing in SonarCloud for .Net solution

I have issues seeing details of the code analysis in SonarCloud. What I have working is a .Net Core application with Coverlet. I do see that the results are uploaded and the coverage shows. However, ...
Blitzoff's user avatar
  • 163
7 votes
1 answer
7k views

Comparison between Snyk and Sonarcloud/SonarQube?

I need to do a comparison between the features and functionality of Snyk and Sonarcloud/Sonarqube and the only thing I can find is a speed comparison: https://snyk.io/blog/sast-tools-speed-comparison-...
mark11's user avatar
  • 73
7 votes
1 answer
6k views

How to integrate SonarCloud with GitHub and Jenkins

I just concluded my GitHub integration with Jenkins so that every time I commit code to my GitHub repository, Jenkins automatically builds. Now I'm trying to integrate SonarCloud too but I haven't ...
H. Soares's user avatar
  • 203
7 votes
0 answers
1k views

Sonar warning S6857: Correct this malformed property placeholder - is this a false positive?

I have a very simple spring boot configuration class like this: @Getter @Configuration public class SomeConfig { @Value("${some.property:some default if property is unset}") private ...
Sören's user avatar
  • 2,186
6 votes
3 answers
21k views

ignoring specific files/folders with sonar.exclusions

I have an ASP.NET MVC5 web app running on an Azure Devops CI/CD pipeline which includes SonarCloud for static code analyses. I am trying to ignore all 3rd party files such as Javascript/JQuery ...
craig2020's user avatar
  • 341
6 votes
3 answers
3k views

Error using Travis CI with Sonarcloud: Not authorized. Please check the properties sonar.login and sonar.password

I'm following Get started instructions on sonarcloud.io to execute the SonarQube Scanner for Maven from my computer: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \ -...
ron190's user avatar
  • 1,072
6 votes
0 answers
423 views

Does SonarQube support any kind of config as code or automation?

From what I have seen I have to configure all of my SonarQube settings from the GUI and it gets stored in a DB? Is there any feature where I could define my SonarQube config as code and deploy it to ...
red888's user avatar
  • 30.5k
5 votes
3 answers
4k views

Building multi-module maven project for SonarCloud

I am building a maven project of X amount of modules for the first time for SonarCloud. The sonar.projectKey value needs to be unique, so I set it to ${project.groupId}:{$project.artifactId}, so that ...
Dragas's user avatar
  • 1,233
5 votes
1 answer
6k views

Analyse Javascript/Typescript project with SonarCloud and Azure DevOps

I have a project containing both Javascript and Typescript files. I'm using SonarCloud to analyse this project from an Azure DevOps pipeline. I set the task Prepare Analysis Configuration in my build ...
Florian F's user avatar
  • 151
5 votes
1 answer
11k views

Sonarcloud shows 0% coverage on new code, and also shows 0% coverage on master branch with gitlab ci

I am using GitLab ci to run SonarCloud code analysis on the code. here is my gitlab-ci.yaml stages: - test before_script: - mkdir -p ~/.ssh && cp $gitlab_private_key ~/.ssh/id_ed25519 ...
Amirsalar's user avatar
  • 709
5 votes
1 answer
2k views

How to fail a maven build, when quality gate fails?

Earlier I use sonar-maven-plugin version 3.2 then when a Sonar quality gate fails the build also used to fail. Now I am using sonar-maven-plugin version 3.7.0.1746, it does not happen so. Even if ...
Shivansh Kumar's user avatar
5 votes
2 answers
3k views

Errors when running sonarqube-gradle-plugin:3.3 with Java 11

In my Android application project I am using the sonarqube-gradle-plugin:3.3 with OpenJDK 11. When I run ./gradlew sonarqube the following is output to the console. It hasn’t been there ever since. It ...
JJD's user avatar
  • 51.2k
4 votes
1 answer
5k views

Loop should be simplified by calling Select - sonar cloud error c#

I get SonarCloud error in this code: foreach (var item in itemList) { if (string.IsNullOrEmpty(item.Name)) { throw new BadRequestException("Item name is null or missing..."); ...
user16358371's user avatar
4 votes
1 answer
2k views

Java string.replace not working as string.replaceAll

I have an entry coming from database in the below format. I first used replaceAll instead of replace function but SonarCloud show error and asks to change from replaceAll to replace. However, the ...
Shruti Joshi's user avatar
4 votes
2 answers
3k views

CodeCoverage not showing in SonarCloud in a Python project

I'm trying to include the codecoverage from my Python project. First I executed the command py.test --cov=tests/ --cov-report xml:cov/coverage.xml to run the tests and report to cov/coverage.xml My ...
Lucas Scheepers's user avatar
4 votes
1 answer
3k views

Sonar Cloud analysis on an NX monorepo

Am just trying to setup a monorepo of angular applications and libraries using NX. Am new to NX but have user sonarcloud before. Now my requirement is to run analysis for the different projects and ...
aneeshere's user avatar
  • 539
4 votes
1 answer
5k views

Code coverage is not showing up in SonarCloud after Azure devops build

We have a multi module Maven project and using JaCoCo for code coverage analysis. I prepared the pom file to run the test cases and pick up the code coverage. Below is my pom.xml with JaCoCo and other ...
saikumar reddy's user avatar
4 votes
2 answers
4k views

SonarCloud requiring code coverage for files ignored with Istanbul

I have a JavaScript app where we generate a code coverage report using Istanbul and use SonarCloud for static analysis. There are two ways we exclude code from the Istanbul. The first is to set ...
JamesFaix's user avatar
  • 8,428
4 votes
1 answer
549 views

How to analyze Git submodules using SonarCloud?

I'm currently trying to setup a Maven multi-module project in order to gather some metrics. Some of these modules are GitHub submodules and they don't show up when running the SonarCloud analysis. We'...
joss-enet's user avatar
4 votes
0 answers
1k views

SonarCloud project not found by Maven plugin for Azure Devops Pipelines

I am compiling a Maven project with Azure Devops Pipelines. Following is the relevant code (don't mind indentation, it's in an if branch). I had successfully run earlier analyses on the main branch, ...
usr-local-ΕΨΗΕΛΩΝ's user avatar
4 votes
0 answers
569 views

How to automatically add issues to GitHub repo from Sonarcloud issues

After every Sonarcloud analysis of my GitHub repo, I get informed of issues and bugs on Sonarcloud's project page. Is there a way to automate the process to get those issues published to GitHub issues ...
Yiğid BALABAN's user avatar
4 votes
0 answers
1k views

Analyzing c# project using travis and sonarcloud gives "no lines of code"

I've been struggling with this issue for a few days now and I can't seem to pinpoint what I'm doing wrong. I've been trying to analyze a c# project that is build with travis CI and analyzed in ...
Joris Onghena's user avatar
3 votes
3 answers
12k views

Run SonarScanner analysis with Java 11, run target code with Java 8

As the following announcement points out, SonarSource ended support to run code Analyzers with pre-11 Java versions: January 2021 - Move analysis to Java 11 The version of Java installed in the ...
chomp's user avatar
  • 1,342
3 votes
1 answer
8k views

Sonarcloud alerts "not enough arguments" when logging exceptions using SLF4J

I manage an open source project in Java and have about 20 places in my code where I log exceptions using the following pattern (slf4j version 1.7.30) private static final Logger logger = ...
Daniel Widdis's user avatar
3 votes
2 answers
7k views

sonar cloud plugin fails on missing class

I have an public project on github. i try to attach sonarcloud to it: ./mvnw -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar....
piotrek's user avatar
  • 14.4k
3 votes
1 answer
1k views

Sonarcloud is not authorized using Travis CI and Maven

I have an experimental project on my Github used for the practising the CI service integrations. I struggle with using Sonarcloud. I have followed both Tavis CI + Sonarcloud tutorial and Maven example....
Nikolas Charalambidis's user avatar
3 votes
1 answer
3k views

SonarScanner for .NET fails in GitHub Actions (.NET 5)

I'm trying to use SonarCloud in my GitHub Actions builds to analyze my code and to produce code coverage for my unit tests. I'm working on a .NET 5 solution in Visual Studio 2019. At first, I was ...
ngruson's user avatar
  • 1,284
3 votes
1 answer
8k views

Run SonarCloud Analyze Manually From Visual Studio

I have paid account in Sonarcloud and Gitlab CI for automation, I use Visual Studio with integrated SonarLint for C#. Sometimes I want to run analyzing manually from VS and not using Gitlab runner ...
user avatar
3 votes
1 answer
1k views

SonarCloud Could not import unit test report TRX Unrecognized root element <TestRun>

I'm new to testing and i'm trying to run my unit tests and coverage for .NET in Azure Pipelines and send it to SonarCloud. When i run my unit tests using VSTest I get the TRX file, and .coverage file. ...
wolfdebs's user avatar
  • 193
3 votes
2 answers
3k views

How to send .coverage file to SonarCloud

i'm new to sonar cloud and my company implmented it in AzureDevOps Pipeline. The problem we are facing is that, to know our code coverage we have to create a pull request and build the solution in ...
Miguel Vale's user avatar
3 votes
0 answers
6k views

Integration test code coverage report for Go lang project in SonarQube

Installed cover tool with following command: go get golang.org/x/tools/cmd/cover I'm able to run unit test and update the test and coverage result in Sonar with following config and method (all test ...
Shiva's user avatar
  • 717
3 votes
1 answer
4k views

SonarCloud quality check doesn't work after running scan

I am trying to run sonarcloud-quality-gate check after performing sonarcloud-scan. I am doing this because I want bitbucket build pipeline should fail if the quality gate check is failed. Doing this ...
Nayan shah's user avatar
3 votes
1 answer
343 views

Authorization error when using Sonarcloud on Travis CI

I am trying to use SonarCloud with Travis-CI and getting the following error: * What went wrong: Execution failed for task ':sonarqube'. You're only authorized to execute a local (preview) SonarQube ...
Shashi Deshetti's user avatar
2 votes
2 answers
9k views

How to configure sonarcloud analysis for Javascript project using Azure DevOps

I am looking for steps to configure sonarcloud analysis for one of our javascript projects, with Azure DevOps as the build platform. The following links have given us some information to start. ...
Santhosh's user avatar
  • 699
2 votes
1 answer
3k views

How to get Jest to have coverage for export only lines?

I have an index.ts top file in an NPM library which has only export statements. i.e.: export * from "./foo" export * from "./bar" SonarCloud is showing those lines as not covered, ...
Felipe Plets's user avatar
  • 7,460
2 votes
2 answers
1k views

How to verify HMAC in HAProxy

Is it possible to check HMAC validity in HAProxy? Ideally I'd like to set an acl if the HMAC is valid so I can use this in rules. Our Ubuntu 18.04 build server (running Jenkins) sits behind a ...
Daps's user avatar
  • 61
2 votes
1 answer
2k views

How to optimize Bitbucket pipeline for Sonarcloud scan pipe?

Every time Sonarcloud scanner starts, it download the image. It slowing down whole pipeline and generate additional cost. Poor documentation don't have any information about additional cache https://...
Mateusz Przybylek's user avatar
2 votes
1 answer
425 views

SonarQube raises error on old code after merging upgrade to java 17

This one is a bit specific. We use SonarCloud, and the "New Code" settings for the relevant project is as following: I.e, on the main branch, only code newer than 2 days is considered. We ...
Saucistophe's user avatar
2 votes
1 answer
3k views

SonarCloud Code Coverage always coming as 0 - GitHub Actions dotnet Core

I am trying to get the Code Analysis done with SonarCloud using the Github actions for my .NET Core application. I have added the below code in my build.yml file for .NET Core Build & Test to ...
linuxuserind's user avatar
2 votes
1 answer
363 views

SonarCloud Authorization Error during Build

I know there exist similar topics but they didn't solve my problem. As suggested in the corresponding posts I followed the steps in: https://about.sonarcloud.io/get-started/ (I did this several ...
Wolfone's user avatar
  • 1,406
2 votes
1 answer
566 views

Exclude the test files for React components in sonarcloud

I have a React application with the following folder structure src components Component1 Component1.tsx Component2.test.tsx Component2 ...
Erick's user avatar
  • 1,128

1
2 3 4 5 6