Lines of code for Vue/JS files are considered higher for the same file after upgrade to Sonar 9.7

Hi there! I’m facing a strange behavior for the JS analysis after the upgrade to Sonar 9.7. Let me explain the details:

  • SonarQube dev edition 9.7

  • When analysing my project in the same way I used to do for Sonar 9.6, I have realised that the number of lines of code for my JS project have increased significantly. After some investigation, I have realised that, for the same file, now Sonar considers that LoC have increased from 243 and 452 (see screenshot).

  • I have observed something similar for other JS projects (see screenshots), so I wonder whether this is a bug introduced on the latest release or if this is expected.

Hey there.

Take a look at this issue and the linked discussion post: Count lines of code in `template` and `style` of `.vue` files · Issue #3251 · SonarSource/SonarJS · GitHub

Hi Colin,

thanks for your message. This is also happening for some other projects of ours in which we’re not using vue, but JS. Is that also expected?

On the other hand, is there any kind of configuration that could be done to go back to the old file processing? We haven’t seen any additional suggestions, code smells or issues in general by increasing the LoC, but we’ve almost reached our total number of LoC for our license suddenly after this change, as we have multiple JS projects.

I don’t think so. You might try standing up a v9.6 Community Edition instance and see if you can identify specific files that have changed in their LoC reporting (that aren’t Vue files) and show them here, to see if we can find any explanation not linked to a change in the codebase.

There is not.

Hi Colin,

after investigating about the increase of lines in other projects not using vue, there’s a good reason behind it. It just happened almost at the same time as the increase for vue files, hence the confusion.

All good then, thanks a lot for your support!

1 Like

Thanks for the follow-up!