3
votes

I am trying to add SonarQube analysis to our OSS Project with travis on Github.

I performed the following steps:

  1. Create a organization and project on sonarcloud.io
  2. Add the sonarcloud definition in .travis.yml
  3. Create a sonar-project.properties file
  4. Push everything to a feature branch called feature/sonarcloud
  5. Add this branch to travis.yml and properties file.

The final result can be seen here: https://github.com/open62541/open62541/tree/feature/sonarcloud

Unfortunately Travis does not submit the sonar analysis:

INFO: Scanner configuration file:
/home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner analysis skipped

(See also https://travis-ci.org/open62541/open62541/jobs/287631673)

I already tried to forcefully set export SONARQUBE_SKIPPED=false but it is still skipped. How can I find out why the scanner analysis is skipped?


Related questions:

1

1 Answers

2
votes

As you can read in the Travis CI logs, at line 556:

Skipping SonarCloud Scan because this branch is not master or it does not match declared branches

This is because you haven't activated analysis on that "feature/sonarcloud" branch. As described in the official documentation, you can achieve that like this:

  addons:
    sonarcloud:
      organization: open62541
      token:
        secure: "..."
      branches:
        - master
        - feature/sonarcloud