# Sonar issues are reported in master branch, but not in the feature branches

**URL:** <https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127>\
**Category:** SonarQube Server / Community Build\
**Tags:** bamboo, coverage\
**Created:** [June 1, 2022, 4:53am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127 "2022-06-01T04:53:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vibinsj](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vibinsj/32/29715_2.png) [@vibinsj](https://community.sonarsource.com/u/vibinsj)\
**Post date:** [June 1, 2022, 4:53am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/1 "2022-06-01T04:53:33Z")

</div>

we are facing an issue where the feature branch cloned from master is getting passed with sonarqube, but the master branch throws error(code smell and condition coverage) after merging the feature branch to the master.

- The way the sonar analysis run is the same for both feature branch and master,
- The new code period is set as reference branch to the master, where as the master branch is set to 30 days period.
- Note we recently upgraded our sonarqube version to 8.9 LTS,  
There are two questions here,

1. How is the reference branch new code period works, i believe it should be from the point of forking of the feature branch and gets compared to master branch. But every-time I do a rebuild of feature branch the new code period in sonar gets changed , is this expected?
2. what is the optimal setting for a new code period setting with reference branch?

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 1, 2022, 8:45am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/2 "2022-06-01T08:45:42Z")

</div>

Hey there.

Before focusing too much on the New Code Period, I think it’s worth that you check your **Quality Gate** to ensure that you are checking the same conditions on **New Code** as **Overall Code**.

Can you share a screenshot of the Quality Gate applied to this project?

---

<div class="post-metadata">

**Author:** ![vibinsj](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vibinsj/32/29715_2.png) [@vibinsj](https://community.sonarsource.com/u/vibinsj)\
**Post date:** [June 2, 2022, 5:34am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/3 "2022-06-02T05:34:42Z")

</div>

![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/7/a/7a6bf8b2f558cf7f2956b0a0fee758d985dee92e.png)  
Here is the screenshot,

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 2, 2022, 8:55am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/4 "2022-06-02T08:55:59Z")

</div>

Thanks. Normally issues like this arise when the New Code conditions are _less strict_ than Overall Code, but clearly that’s not the case here 😂

Maybe you can share a screenshot of a Pull Request that you expected to fail the Quality Gate but didn’t (and then those code changes failed the Quality Gate once merged into master). Is the Pull Request analysis actually reporting that anything has changed in the **Code** tab?

---

<div class="post-metadata">

**Author:** ![vibinsj](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vibinsj/32/29715_2.png) [@vibinsj](https://community.sonarsource.com/u/vibinsj)\
**Post date:** [June 16, 2022, 5:52am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/5 "2022-06-16T05:52:33Z")

</div>

Hi Colin,

Apologies for the long delay the way we do the analysis, is that every feature branch gets sonar analysis run whenever a new code change is detected. It gets cleared of all issues reported and then merged into master branch, which again runs sonar analysis on overall code once again.  
I dont have an pull request type analysis to share with you,

But recently found few issues

1. If i make 3 commits to my feature branches and run sonar analysis on the build where the 3rd commit is done, it picks up only the 3rd committed changes not the overall changes from reference branch.

2. Sometimes the files that are changed are held back from analysis with missing blame informations,  
one such build snippet is below, where the newfilepath below is the file with newly added changes.

=====================================

| build | 15-Jun-2022 21:06:49 | [INFO] This git repository references another local repository which is not well supported. SCM information might be missing for some files. You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it. |
| --- | --- | --- |
| build | 15-Jun-2022 21:06:49 | [INFO] SCM Publisher 2/4 source files have been analyzed (done) |
| build | 15-Jun-2022 21:06:49 | [WARNING] Missing blame information for the following files: |
| build | 15-Jun-2022 21:06:49 | [WARNING] \* pom.xml |
| build | 15-Jun-2022 21:06:49 | [WARNING] \* **newfilepath** |
| build | 15-Jun-2022 21:06:49 | [WARNING] This may lead to missing/broken features in SonarQube |
| build | 15-Jun-2022 21:06:49 | [INFO] CPD Executor 14 files had no CPD blocks |
| build | 15-Jun-2022 21:06:49 | [INFO] CPD Executor Calculating CPD for 85 files |
| build | 15-Jun-2022 21:06:49 | [INFO] CPD Executor CPD calculation finished (done) |
| build | 15-Jun-2022 21:06:49 | [INFO] Load New Code definition |
| build | 15-Jun-2022 21:06:50 | [INFO] Load New Code definition (done) |
| build | 15-Jun-2022 21:06:50 | [INFO] Analysis report generated in 377ms, dir size=1 MB |
| build | 15-Jun-2022 21:06:50 | [INFO] Analysis report compressed in 275ms, zip size=558 KB |
| build | 15-Jun-2022 21:06:50 | [INFO] Analysis report uploaded in 390ms |

==================================  
we don’t use shallow clones or git submodules too

let me know if you need any more data and screenshots and let me know if it can be shared securely.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 16, 2022, 8:23am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/6 "2022-06-16T08:23:28Z")

</div>

Hey there.

> [@vibinsj](#):
>
> This git repository references another local repository which is not well supported. SCM information might be missing for some files. You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it.

This warning will only appear if _.git/objects/info/alternates_ is found, which would indicate the repository is borrowing objects from another repository. I would double-check that your statement here is correct.

> [@vibinsj](#):
>
> we don’t use shallow clones or git submodules too

---

<div class="post-metadata">

**Author:** ![vibinsj](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vibinsj/32/29715_2.png) [@vibinsj](https://community.sonarsource.com/u/vibinsj)\
**Post date:** [June 16, 2022, 11:52am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/7 "2022-06-16T11:52:47Z")

</div>

Hi Colin,

yes I am pretty sure. we use bamboo for our CI/CD process and we don’t have them enabled.  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/e/e/ee32ecebad5dc1e3d5ccb9e9127507e60d74a298.png)  
does this lack of blame information cause the new changes not being picked up for analysis, if so it shouldn’t be an warning.

---

<div class="post-metadata">

**Author:** ![vibinsj](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vibinsj/32/29715_2.png) [@vibinsj](https://community.sonarsource.com/u/vibinsj)\
**Post date:** [June 20, 2022, 4:34am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/8 "2022-06-20T04:34:03Z")

</div>

Hi Collin,

Good day, Is there any update for me. Is there something I can do to check this issue.

Regards,  
Vibin.J

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [June 20, 2022, 8:52am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/9 "2022-06-20T08:52:40Z")

</div>

I would start by checking the _git/objects/info/alternates_ in your repository to understand why SonarQube is raising this warning.

---

<div class="post-metadata">

**Author:** ![vibinsj](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vibinsj/32/29715_2.png) [@vibinsj](https://community.sonarsource.com/u/vibinsj)\
**Post date:** [June 30, 2022, 10:27am UTC](https://community.sonarsource.com/t/sonar-issues-are-reported-in-master-branch-but-not-in-the-feature-branches/64127/10 "2022-06-30T10:27:18Z")

</div>

Hi Colin,

we were able to fix the scm blame information by disabling the agent cache and it worked for us.  
But still the problem of issues missing feature branch persists.
