# PR check the whole file and not just changed code in Azure DevOps

**URL:** <https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588>\
**Category:** SonarQube Cloud\
**Tags:** azuredevops-services, pull-request\
**Created:** [June 1, 2020, 8:58am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588 "2020-06-01T08:58:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carike](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carike/32/12160_2.png) [@Carike](https://community.sonarsource.com/u/Carike)\
**Post date:** [June 1, 2020, 8:58am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/1 "2020-06-01T08:58:58Z")

</div>

Would appreciate assistance on how to configure SonarCloud pull request to only look at code that we have changed and not analyse the whole file.

For example, code that was not changed in the PR gets flagged like this:

 ![Code that was not touched get's flagged during the PR](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/7/7b8fb5bf16ac391d495be7abdfe283ed89489b19.png)

I have followed the [SonarCloud Labs for Azure Devops](https://docs.microsoft.com/en-us/labs/devops/sonarcloudlab/?tutorial-step=4) to configure the PR;s but nowhere could I find where I could change these settings. Then I checked the [documentation](https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-azure-devops/) available and also could not find any additional information that would help to specify that it only checks changed code.

**Details about our SonarCloud project:**

- ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
- CI system used Azure DevOps
- Languages of the repository are SQL, C# and JavaScript
- Our SonarCloud project is private so unfortunately can’t share the URL

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [June 2, 2020, 6:04am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/2 "2020-06-02T06:04:46Z")

</div>

Hi @Carike and welcome to the community !

Has this issue already been reported on the target branch of your PR ? Or at least the default branch of the repo ?

---

<div class="post-metadata">

**Author:** ![Carike](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carike/32/12160_2.png) [@Carike](https://community.sonarsource.com/u/Carike)\
**Post date:** [June 2, 2020, 7:04am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/3 "2020-06-02T07:04:20Z")

</div>

Hi @mickaelcaro

Thank you very much for the welcome 🙂

The issue currently reported, is on a new feature branch and I can’t find that it has been flagged on our default branch either.

We have had SonarCloud implemented on our code base about two years, but only recently started with the PR decorations and it’s flagging lot of code.

So, of course, these need to be resolved but currently, we just want to check the code that changed in the PR. From the screenshot, you can see that that line of code was unchanged. A colleague mentioned that he read somewhere that it should just check the new code and wondering if we can configure it somewhere.

Thanks again for the assistance!

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [June 2, 2020, 8:29am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/4 "2020-06-02T08:29:38Z")

</div>

If there have been some file move or renaming, those issues might be raised if they have not been before, so if you didn’t find this issue on any branch, i think that this is the normal behavior then.

---

<div class="post-metadata">

**Author:** ![Carike](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carike/32/12160_2.png) [@Carike](https://community.sonarsource.com/u/Carike)\
**Post date:** [June 2, 2020, 8:42am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/5 "2020-06-02T08:42:17Z")

</div>

@mickaelcaro we have not moved or renamed the files, and in this example that commented line has been there for a while. So we are wondering why it is now being flagged since it’s not new.

On this one PR we have found more than 50 issues flagged, that is not related to the code changes made. Therefore feel that they are incorrectly being flagged during the PR. It’s also not just this branch but many others as well.

Is there a way we could perhaps configure the “sensitivity” of how the items get flagged?

Thanks again!

---

<div class="post-metadata">

**Author:** ![mickaelcaro](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mickaelcaro/32/4147_2.png) [@mickaelcaro](https://community.sonarsource.com/u/mickaelcaro)\
**Post date:** [June 3, 2020, 6:41am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/6 "2020-06-03T06:41:45Z")

</div>

Is the target branch of your PR the default branch of your repo ? Or a feature branch that may be not rebased since a long time ?

---

<div class="post-metadata">

**Author:** ![Carike](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/carike/32/12160_2.png) [@Carike](https://community.sonarsource.com/u/Carike)\
**Post date:** [June 4, 2020, 6:30am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/7 "2020-06-04T06:30:35Z")

</div>

No in this instance the target branch was a feature branch that was recent created from the Master-branch.

We are nearing the LOC count of our plan and I am wondering if that might not be also causing the issue since it can’t complete the analysis of the other branches.

@mickaelcaro I am going to do a bit more digging on our SonarCloud setup and will then perhaps ask for your guidance again, but thank you for your assistance so far.

---

<div class="post-metadata">

**Author:** ![romainbourre-areas](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/romainbourre-areas/32/48160_2.png) [@romainbourre-areas](https://community.sonarsource.com/u/romainbourre-areas)\
**Post date:** [October 3, 2023, 8:49am UTC](https://community.sonarsource.com/t/pr-check-the-whole-file-and-not-just-changed-code-in-azure-devops/25588/8 "2023-10-03T08:49:58Z")

</div>

Hi Carike!

Have you found solution about your issue? I have the same thing here, and I only want comment on the new/changed code.

Thanks!
