SonarQube Exclude a directory

sonar.exclusions not working
sonar.exclusions maven
sonar exclude package
sonarqube ignore rule
sonar.sources example
exclude js files from sonar analysis
sonarqube exclude folder not working
sonar.coverage.exclusions c#

I am trying to exclude a directory from being analyzed by Sonar. I have the following properties defined in my sonar-project.properties file:

sonar.sources=src/java
sonar.exclusions=src/java/test/****/*.java

The directory structure I have is:

src/java/dig
src/java/test/dig

When I run the sonar-runner I get the following info:

 INFO  - Excluded sources:
 INFO  -   src/java/test/**/*.java
 INFO  - Excluded tests:
 INFO  -   **/package-info.java

But when I check the result of the analysis all the packages inside the test directory are still there.

I just need to tell Sonar to not analyze the test directory and any packages inside it.


Try something like this:

sonar.exclusions=src/java/test/**

SonarQube Exclude a directory, Hey guys. It is my first time using SonarQube and I am running it from prompt and Azure DevOps (VSTS Build). Both works fine and the results  If you do not use npm it is quite normal to have third party javascript code in your source code and if you are using SonarQube you absolutely need to configure it to exclude that directories. Just go to the administration page of the project and in the Analysis Scope you find the Source File Exclusions section that allows you to exclude some directories from the analysis.


I able to exclude multiple directories using the below config(comma separated folder paths)

sonar.exclusions=system/**, test/**, application/third_party/**, application/logs/**

And while running the sonar runner I got the following in the log

Excluded sources: 
  system/**
  test/**
  application/third_party/**
  application/logs/**

How exclude files from analysis and include on the same folder , How do I exclude a package from sonar code coverage? I am trying to exclude some folders from Sonar scan through VSTS build. We have used Sonar plugin for MSBuild. If I use the exclusion pattern as **/*.cs then it is excluding all the .cs files. My goal is to exclude whole folder from scan. I have tried the following patterns but none of them seems to work


This will work for your case:

sonar.exclusions=**/src/java/dig/ ** , **/src/java/test/dig/ **

“Ignore Issues on Multiple Criteria” in SonarQube, Exclusions property. See the Patterns section for more details on the syntax. In addition, if I want to exclude generated files from analysis, I would need to put file:/generated-sources/ as I saw in another answer. However, after analysis, I can still view the analysis results of those files when I open up the project in SonarQube dashboard.


If we want to skip the entire folder following can be used:

sonar.exclusions=folderName/**/*

And if we have only one particular file just give the complete path.

All the folder which needs to be exclude and be appended here.

How To Measure Code Coverage Using SonarQube and Jacoco , How exclude files from analysis and include on the same folder? inclusions. Hi, trying to setup sonar scanner with some similar requirements,  When using SonarQube 6.7.5 Community Edition on Windows Server 2016 using SQL Server 2016 and Java 8, unable to exclude a directory from being analysed by SonarQube My directory structure is: Source/Coral Source/Emerald Source/Sapphire I need to exclude the Emerald directory, all it’s sub-directories and files Reviewed the following knowledge base document on https://docs.sonarqube.org


Another configuration option is adding a maven properties sonar.exclusions. Below is a sample pom file with exclusions of static jquery directory and static pdf viewer directory.

<project >
<modelVersion>4.0.0</modelVersion>
<artifactId>my Artifact</artifactId>
<!-- Enviroment variables can be referenced as such: ${env.PATH} -->
<packaging>war</packaging>
<url>http://maven.apache.org</url>

<properties>

    <junit.version>4.9</junit.version>
    <mockito.version>1.9.5</mockito.version>
    <jackson.version>1.9.7</jackson.version>
    <powermock.version>1.5</powermock.version>

    <!--Exclude the files Here-->
    <sonar.exclusions>src/main/webapp/static/jquery_ui/*,src/main/webapp/static/pdf-viewer/*,src/main/webapp/static/pdf-viewer/**,src/main/webapp/static/pdf-viewer/**/*</sonar.exclusions>
</properties>

Setting sonar scanner exclusions - SonarQube, Creating a build that is capable of perform a SonarQube analysis on a VSTS you absolutely need to configure it to exclude that directories. describes to some detail how to exclude code from analysis, but it doesn't tell me how to exclude multiple directories. A comma-separated list like this (in sonar-project.properties) doesn't work: sonar.exclusions=com/example/package1/*.java,com/example/package2/*.java The parser seems to stop at the comma, so excludes only the first set of files.


Exclude Folders from SonarQube analysis – Alkampfer's Place, In my case I needed to exclude source files. SonarQube uses a nice wildcard syntax to make exclusion easier: image. We used the following  SonarQube gives you several options for configuring exactly what will be analyzed. You can. completely ignore some files or directories; exclude files/directories from Issues detection (specific rules or all of them) but analyze all other aspects; exclude files/directories from Duplications detection but analyze all other aspects


SonarQube Quick Tip: Exclude Files from Analysis and Speedup , How to exclude multiple directories. Hi there, the documentation at http://docs.​codehaus.org/display/SONAR/Project+Administration describes  SonarQube Quick Tip: Exclude Files from Analysis and Speedup Analysis February 2, 2018 February 2, 2018 / Uncategorized / 2 Comments I setup a new CI build with SonarQube analysis this week and noticed right off there were far more lines of code for the project than I was expecting.


Exclude Third-Party Sources From Sonar, Is there any possibility to exclude folders/files from analysis/coverage by a wildcard pattern for the modules? Like it would be possible with the  In addition, if I want to exclude generated files from analysis, I would need to put file:/generated-sources/ as I saw in another answer. However, after analysis, I can still view the analysis results of those files when I open up the project in SonarQube dashboard.