# Unable to integrate automatic PR comments for newly changed code using SonarCloud

**URL:** <https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895>\
**Category:** SonarQube Cloud\
**Tags:** sonarqube-cloud\
**Created:** [December 10, 2024, 3:22am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895 "2024-12-10T03:22:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![in0hpln\_festo](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/in0hpln_festo/32/64925_2.png) [@in0hpln\_festo](https://community.sonarsource.com/u/in0hpln_festo)\
**Post date:** [December 10, 2024, 3:22am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/1 "2024-12-10T03:22:31Z")

</div>

Hi Team,

We’re integrating SonarCloud with Azure DevOps for clean code and coding standardization. To achieve this, we have configured automatic PR comments in Azure DevOps with the help of SonarCloud analysis. However, the problem is that we are receiving PR comments for only old code changes, while our expectation is that the comments should apply only to the current PR, not the entire source code.

We need your help to resolve this issue. We have already gone through your community questions and answers, but nothing has helped us.

Thank you.

---

<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:** [December 10, 2024, 9:46am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/2 "2024-12-10T09:46:16Z")

</div>

Hey there.

Have you already analyzed the main branch of your project? This typically happens when the main branch (the branch these PRs are targeting) hasn’t been analyzed.

---

<div class="post-metadata">

**Author:** ![in0hpln\_festo](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/in0hpln_festo/32/64925_2.png) [@in0hpln\_festo](https://community.sonarsource.com/u/in0hpln_festo)\
**Post date:** [December 11, 2024, 2:41am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/3 "2024-12-11T02:41:04Z")

</div>

Yes, the ‘main’ branch has not been analyzed yet, but we’re trying to configure it through another branch. Consider that we have the ‘main’ branch as the development branch, and from the development branch, we created a new branch called ‘sonarcloud-configuration.’ All our configuration setup is in this branch, not in development.

---

<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:** [December 11, 2024, 9:21am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/4 "2024-12-11T09:21:28Z")

</div>

Thanks. This is ringing a bell, and I’m going to try and reproduce this. However in the meantime, can you double check that shallow cloning is turned off?

> [@SonarCloud Scans Unchanged Files from Different Folders During Pull Request Analysis](https://community.sonarsource.com/t/sonarcloud-scans-unchanged-files-from-different-folders-during-pull-request-analysis/126348/2):
>
> Hey there. Have you made sure to [disable shallow cloning](https://docs.sonarsource.com/sonarcloud/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)? steps: - checkout: self # Disable shallow fetch fetchDepth: 0

---

<div class="post-metadata">

**Author:** ![in0hpln\_festo](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/in0hpln_festo/32/64925_2.png) [@in0hpln\_festo](https://community.sonarsource.com/u/in0hpln_festo)\
**Post date:** [December 16, 2024, 2:53am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/5 "2024-12-16T02:53:09Z")

</div>

I’m not receiving any comments after disabling shallow cloning with the setting of fetchDepth: 0. Could you please share any other suggestions or provide me with a solution if you find one?

---

<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:** [December 16, 2024, 1:43pm UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/6 "2024-12-16T13:43:36Z")

</div>

It sounds like you’re on the right track if you’re no longer receiving PR comments for old code.

Have you tried intentionally introducing an issue in a PR (our [rules site](https://rules.sonarsource.com/) should give you inspiration, make sure it’s a rule enabled in your Quality Profile!)?

---

<div class="post-metadata">

**Author:** ![in0hpln\_festo](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/in0hpln_festo/32/64925_2.png) [@in0hpln\_festo](https://community.sonarsource.com/u/in0hpln_festo)\
**Post date:** [December 18, 2024, 5:31am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/7 "2024-12-18T05:31:59Z")

</div>

Thank you, the issue has been fixed based on your suggestion. However, PR comments are not working for a few files. We’ll resolve that; I think it may be related to the Quality Gate.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [December 25, 2024, 5:32am UTC](https://community.sonarsource.com/t/unable-to-integrate-automatic-pr-comments-for-newly-changed-code-using-sonarcloud/131895/8 "2024-12-25T05:32:27Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
