S138 Doesn't trigger when a method gets too big in a pull request

Versions Used

  • SonarQube version: 9.5
  • SonarScanner: Dotnet-sonarscanner.5.7.2

Observations
When a relatively long method becomes longer as part of a PR in such a way that it exceeds the maximum length set-up for that rule, it doesn’t trigger S138. It only treats the extra lines as “new code”. Only after merging the PR to the target branch, it’ll pop-up. Is this by design? FYI, when I also touch the method signature, it suddenly pops up in the PR as well.

This a limitation of our strategy with raising issues on PRs – which is to only raise issues on changed lines of changed files. I’d highly encourage you to add your voice to this roadmap item: https://portal.productboard.com/sonarsource/3-sonarqube/c/295-new-pull-request-issues-on-unchanged-code

OK. Thank you for confirming. At least it means it’s not something we caused.