I am using OCLint on an Objective C project to obtain a SonarQube profile.
Now my IOS Objective C project contains a src directory with multiple sub src directories. In my sonar-project.properties
file there is a following entry
sonar.sources=MySrcFolder/
Now within this src folder i want to run the sonar profile on multiple subfolders and exclude some third party src folders. Can anyone help me with this ? As it stands now, sonar runs the profile on all src in any of the above folders subfolders ?
You should place a sonar-project. properties file in the root of each project and configure project-specific values such as sonar. sources only in these project-specific files and not in the scanner's root configuration file.
To answer your question: sonar. projectBaseDir is used to point analysis at a different directory than the one analysis is fired from. This should only be set explicitly (it's set implicitly to .
You can do it only with sonar.sources
property or with the sonar.exclusions
and sonar.inclusions
properties.
Example:
MySrcFolder
src1
src2
src3
src4
If you want to analyze only src1
and src3
then,
1) sonar.sources=MySrcFolder/src1,MySrcFolder/src3
OR
2)
sonar.sources=MySrcFolder
sonar.exclusions=src2/**,src4/**
OR
3)
sonar.sources=MySrcFolder
sonar.inclusions=src1/**,src3/**
Following rules are applied in the exclusions
and inclusions
properties:
* Match zero or more characters
** Match zero or more directories
? Match a single character
file: Prefix to define a pattern based on absolute path
For more details: http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus
Add below lines to sonar-scanner-v.x.x/conf/sonar-scanner.properties file. Use Comma-separated paths to analysis multiple modules or projects.
sonar.sources= mainDir/subDir/src, mainDir/subDir/subDir/src,...
Or
Set base directory with **sonar.projectBaseDir** param.
Thanks to the param, you can give relative path to sonar.sources's params.
Then
Run sonar-scanner.bat file in mainDir or root in directory of above sources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With