Scope of 'new code' in sonar qube

Generic question:

What is included in ‘new code’ in quality gate criteria. If I have a file in a repository of say 1000 lines and I change 1 line of code in a method of 10 lines, how many lines are considered as ‘new code’. 1 (new code granularity on line basis) or 10 (new code granularity on method bas) or 1000 lines (new code granularity on file base)



Welcome to the community!

We calculate “new” code based on two things:

So in your example, assuming that the 1 changed line falls within the New Code definition, then it will be considered new, and only that one line.

Does that help?