Sonar project-properties file

AndroidDev picture AndroidDev · May 3, 2014 · Viewed 28.2k times · Source

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 ?

Answer

L. Langó picture L. Langó · May 5, 2014

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