Adding one line to an old duplicated block marks it new

Hi Ann,

I have read out you most of the bloges thats realy helpfull to me,

Related to above question i have a same type of query,

like, we have already duplicated blocks in code, if developer add or modifie some of the lines on same blocks then QG fails because we have set QG condition on new code with 50% duplication pass. my question is, this were old code so how sonarqube consider that code as a new code? developer just added one line code but sonar considering all block as a new code.


1 Like

Hi Saurabh,

Welcome to the community!

I’m glad you’ve found my posts helpful. :slightly_smiling_face:

Regarding your old/new duplicated block, sorry but that’s just how it works. If you modify part of a duplicated block - rather than fixing it - the whole block gets marked as new.

This is kinda about Clean as You Code. The idea is that you make sure you don’t add any new problems, but also that you clean up the code you’re working in. So ideally your developer would have fixed the duplication rather than just modifying it.



Thank you so much for your reply.