Questions tagged [sonarcloud]

SonarCloud is the code quality cloud service provided by SonarSource.

The main features of SonarCloud are:

  • 16 languages: Java, JS, C#, C/C++, Objective-C, TypeScript, Python, ABAP, PLSQL, T-SQL and more.
  • Thousands of rules to track down hard-to-find bugs and quality issues thanks to powerful static code analyzers.
  • Cloud CI Integrations, with Travis, VSTS, AppVeyor and more.
  • Deep code analysis, to explore all source files, whether in branches or pull requests, to reach a green quality gate and promote the build.
  • Fast and Scalable
227 questions
5
votes
3 answers

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 it would be generated per module. Afterwards, run…
Dragas
  • 1,140
  • 13
  • 29
5
votes
1 answer

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 quality gate fails maven build succeeded. Now when I…
Shivansh Kumar
  • 321
  • 1
  • 5
  • 16
5
votes
1 answer

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 libraries which are throwing up a lot of "Bugs" and…
craig2020
  • 321
  • 1
  • 6
  • 12
5
votes
1 answer

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 pipeline like this: - task: SonarCloudPrepare@1 …
Florian F
  • 151
  • 2
  • 6
4
votes
0 answers

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, so now I tried to fix some mistakes and open a…
usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
4
votes
2 answers

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 sonar-project.properties…
Lucas Scheepers
  • 505
  • 6
  • 24
4
votes
1 answer

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 libraries and have them show in SonarCloud. I…
aneeshere
  • 509
  • 5
  • 16
4
votes
0 answers

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 of my repository? Edit: Also see this question:…
fyb
  • 145
  • 13
4
votes
3 answers

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 scanner environment must be upgraded to at least Java…
chomp
  • 1,352
  • 13
  • 31
4
votes
1 answer

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 plugins added and in Azure Devops build am…
4
votes
1 answer

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 replace dosen't replace all the backslash, infact it…
Shruti Joshi
  • 301
  • 1
  • 4
  • 16
4
votes
0 answers

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 sonarcloud. I've set up travis (see:…
Joris Onghena
  • 145
  • 1
  • 1
  • 11
4
votes
1 answer

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're using Travis CI and I have configured…
joss-enet
  • 63
  • 4
3
votes
1 answer

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..."); } if (someOtherList.Any(x => x.Name ==…
user16358371
  • 101
  • 1
  • 7
3
votes
1 answer

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 && chmod 600 ~/.ssh/id_ed25519 && touch…
Amirsalar
  • 648
  • 9
  • 18
1
2
3
15 16