Travis CI sonar-scanner send analysis to unexpected branch

i have job running on Travis CI, “development” branch build,
triggering “sonar-scanner” addon command

here 's the properties file:

sonar.projectKey=my-project-key
sonar.sources=src

i am expecting the result is sync to sonarcloud 's “development” branch

but i found “master” branch dashboard got updated.

p.s. it’s a new project, “master” does not have any analysis before

Hi Elton, is development your default branch on GitHub? If yes, then you just need to rename the default branch in SonarCloud (in the “Administration > Branch & Pull Requests” project menu).

i would like to keep the default branch on GitHub and SonarCloud different.
my current solution is passing the branch argument “-Dsonar.branch.name=$TRAVIS_BRANCH”
it best if command line tool “sonar-scanner” , can auto detect $TRAVIS_BRANCH , when it’s a branch build on Travis CI

Can you expand on this? What’s the reason?

SonarCloud default to display “master” on dashboard, as it’s production version
GitHub default to “development”, as most Pull Requests are targeting it, for developer convenience

BTW, are you using the SonarCloud Travis CI add-on to trigger the analysis? Things should work fine out of the box.

https://docs.travis-ci.com/user/sonarcloud/#inspecting-code-with-the-sonarqube-scanner

i was following this