# New code metric getting confused

**URL:** <https://community.sonarsource.com/t/new-code-metric-getting-confused/10456>\
**Category:** SonarQube Cloud\
**Created:** [June 4, 2019, 7:41pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456 "2019-06-04T19:41:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtsievert](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jtsievert](https://community.sonarsource.com/u/jtsievert)\
**Post date:** [June 4, 2019, 7:41pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/1 "2019-06-04T19:41:57Z")

</div>

We have a quality gate breaking for a short lived branch where Sonar is reporting over 600 new lines of code where the commit only had 6 lines changed. With this massive amount of changes the sonar is seeing the code coverage metric fall below the default quality gate. Looking for assistance to tracking down why the new code and likewise the resulting code coverage metric got so confused.

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [June 5, 2019, 1:38pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/2 "2019-06-05T13:38:49Z")

</div>

Can you give more details about your context and environment? (which ALM are you using, with which SCM, which CI solution, … etc)

---

<div class="post-metadata">

**Author:** ![jtsievert](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jtsievert](https://community.sonarsource.com/u/jtsievert)\
**Post date:** [June 6, 2019, 3:07pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/3 "2019-06-06T15:07:11Z")

</div>

We are using Azure DevOps and Azure Git. Not sure what information you are looking for on ALM, if you can clarify that I would be happy to provide more information.

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [June 10, 2019, 2:13pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/4 "2019-06-10T14:13:50Z")

</div>

Azure DevOps and Git, that’s what I was looking for, thanks.

Are you doing a shallow clone for your build? This could explain why SonarCloud thinks that most lines are new.

---

<div class="post-metadata">

**Author:** ![jtsievert](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jtsievert](https://community.sonarsource.com/u/jtsievert)\
**Post date:** [June 10, 2019, 2:57pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/5 "2019-06-10T14:57:49Z")

</div>

Nope, just a default checkout. We are not specifying any options.

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [June 12, 2019, 4:12pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/6 "2019-06-12T16:12:02Z")

</div>

@dmeneses I need your help on that one, I don’t remember how we know which lines should be considered as new for the code coverage when you are on a short-lived branch :-/

---

<div class="post-metadata">

**Author:** ![dmeneses](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dmeneses/32/2933_2.png) [@dmeneses](https://community.sonarsource.com/u/dmeneses)\
**Post date:** [June 12, 2019, 4:47pm UTC](https://community.sonarsource.com/t/new-code-metric-getting-confused/10456/7 "2019-06-12T16:47:23Z")

</div>

When possible, we get that information from git.  
@jtsievert do you have the logs of the scanner, preferably with verbose enabled?
