Branch name after scan always shows master branch on sonar dashboard NOT the one on which scan is run

I am trying to run sonar scan on local build using sonar maven plugin, it runs fine. Although I am running on specific branch, but the code smells it shows on the dashboard are always shown on master branch.
I have used the below in my pom.xml

org.sonarsource.scanner.maven
sonar-maven-plugin
3.3.0.603


verify

sonar





<profiles>
    <profile>
        <id>sonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sonar.projectKey>XXXXXX</sonar.projectKey>
           <sonar.organization>default-organization
            </sonar.organization>
            <sonar.host.url>
                XXXXXX
            </sonar.host.url>
            <sonar.branch.name>feat/spot-bug_Sonar
            </sonar.branch.name>
           <sonar.branch.target>feat/spot-bug_Sonar
            </sonar.branch.target>
          <sonar.login>
                XXXXXXX
            </sonar.login>

it does not show any code smell on the branch where I am running the analysis.

Instead it shows the code smells(3) on master branch.![image|690x433]

(upload://tKWvUfDd3N57R7S4zQwaMpQAQSf.png)

INTELLIJ SCREENSHOT

Hi,

Welcome to the community!

Do you have Developer Edition($)? If so you’ll be able to perform branch and PR analysis by passing the correct analysis parameters to analysis. Note that your CI may be able do handle this automatically, and using a CI to run analysis (versus localhost analysis) is best practice.

 
HTH,
Ann