Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Adding a Project

Adding a project to Sonar SonarQubeTM is not done through the web interface, but automatically when the project is analyzed for the first time.

Deleting a Project

You can delete a project in Sonar by clicking on Project Deletion in the left menu.

Note that a service to delete several projects at the same time is available since Sonar version 3.2.

Updating Project Key

Since Sonar version 3.2, the project key can be updated. Go to Configuration > Update Key:

...

Setting Quality Profiles

As Sonar version 3.3 enables multi-language project analysis, project administrators can select which quality profile to use for each language on their project. Go to Settings > Quality Profiles:

...

It is possible to exclude files from being analyzed:

  • Since Sonar version 3.3, go to Configuration > Settings > Exclusions and set the ' sonar.exclusions' property.
  • For Sonar versions prior to 3.3, click on Exclusions in the left menu and set the 'sonar.exclusions' property.
Since Sonar version 3.3, it is also possible to:
  • Exclude tests file from being analyzed: go to Configuration > Settings > Exclusions and set the ' sonar.tests.exclusions' property
  • Set global exclusions that will apply to all the projects: go to Configuration > General Settings > Exclusions and set the 'sonar.global.exclusions' and 'sonar.global.tests.exclusions' properties.

 

Info
titleCoding rules

If you want to exclude source code from being check against some coding rules, you can have a look at the Switch Off Violations plugin.

Since Sonar version 3.5, it is also possible to:

  • Set the files to be analyzed through the 'sonar.inclusions' and 'sonar.test.inclusions' properties. In this case, only these very files will be analyzed.
  • Exclude some files from being checked against duplications. To do so, set the through 'the sonarthe sonar.cpd.exclusions' property (Configuration > Settings > Duplications).

...

  • Fully qualified name of the resource in Sonar (see red frames below):

    For Java only, replace '.' package separator by '/' and add '.java' extension.

    Code Block
    titleExamples
    languagebash
    # Exclude all classes ending by 'Bean'
    # Matches org.sonar.api.MyBean.java, org.sonar.util.MyOtherBean.java, etc.
    sonar.exclusions=**/*Bean.java
     
    # Exclude all classes in the 'org.sonar' package
    # Matches org.sonar.MyClass.java, org.sonar.MyOtherClass.java
    # But does not match org.sonar.util.MyClassUtil.java
    sonar.exclusions=org/sonar/*.java
     
    # Exclude all classes in the 'org.sonar' package and its children
    # Matches org.sonar.MyClass.java, org.sonar.MyOtherClass.java, org.sonar.util.MyClassUtil.java
    sonar.exclusions=org/sonar/**/*.java



  • Absolute path:

    Code Block
    titleExamples
    languagebash
    # Exclude all the *.cs files included in /path_to_my_project/myProject/src/generated and its subdirectories
    sonar.exclusions=file:/path_to_my_project/myProject/src/generated/**/*.cs
     
    # Exclude all the java classes contained in a src/generated/java directory and its subdirectories
    sonar.exclusions=file:**/src/generated/java/**/*.java
    

Full documentation is directly available on the Sonar SonarQubeTM web interface (Configuration > Settings > Exclusions).

...

These links have to be defined in the analysis configuration file:

  • Home: sonar.links.homepage
  • Continuous integration: sonar.links.ci
  • Issue tracker: sonar.links.issue
  • Sources: sonar.links.scm
  • Developer connection: sonar.links.scm_dev

For Maven projects, these links are retrieved from the project POM:

  • Home: <url>
  • Continuous integration: <ciManagement><url> <ciManagement><url>
  • Issue tracker: <issueManagement><url> <issueManagement><url>
  • Sources: <scm><url>
  • Developer connection: <scm><developerConnection>
Setting a sonar.links.* property on a Maven project overrides the one above.

...