Removing comment in a file is scanning the whole file in PR analysis

Hi,

Yes, that’s correct. Only those line - as indicated by the yellow highlight in your screenshot - are considered new.

Going back to your OP:

I think it’s worth explicitly drawing the distinction between “whole file” and “whole function”. At a guess, it’s not reporting “new issues” on the whole file, but only on the function those new lines are in.

I can understand why that’s surprising. Cognitive Complexity issues are reported at the method/function level, and your function declaration isn’t “new”. What’s happening is that the issue is being reported in the PR because of those new lines. Your changes didn’t cause the issue - it was clearly there already - but they made it worse. And that worsening is why it’s being reported in the PR analysis.

Does that make sense?

 
Ann