The Rule of "nested too deeply" - go:S134 have false positive

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 7.7
    SonarGo 1.1.0 (build 1612)
  • what are you trying to achieve

I find that The Rule of “nested too deeply” - go:S134 have false positive, and if the rule find “else if”, it will “Nesting +1”.

But the nesting depth has not increased

func demo() {

   if a != nil {

   } else if a != 1 {

  • what have you tried so far to achieve this

Hello @_YaleChen, thanks for the feedback.

I tested this on a recent version of Go analyzer (1.6.0) and it behaves as expected, the else-if does not increase the nesting.

I would therefore advise you to update SonarQube, or at least update Go analyzer to not face this issue.


Thanks. I will update SonarQube.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.