Lines of Code jump after moving to Dev editition due to new language scan

Hi there,

Using Developer Edition, Version 8.1 with standard scanners that come with it - which is the problem.

With the new edition comes SonarHTML which has caused our lines of code (LoC) count to jump dramatically, something not mentioned in the sales pitch :wink:

Is there a way to switch off a specific scanner for a project, or globally? I tried uninstallin the SonarHtml scanner, but the additional line count was still in the project information pane, but instead of saying “HTML”, it said “Web”, and the increase in the LoC is still present.

How can I exclude HTML from making up the LoC count?

Thank you,

Mike Kingscott

Hi Mike,

You have a couple ways to do this.

  • Add an exclusion on **/*.html
  • Edit the HTML file suffixes to something nonsensical, e.g. “.foo”. (Dirty but effective.)

Both can be done at the global and project levels. The hierarchy of settings is explained at the top of this page.

 
HTH,
Ann

Thank you for your answer.

I added the exclusion “**/*.cshtml” to the project’s Souce File Exclusions in Analysis Scope, and they are still being analysed/included.

I have similar exclusion rules for JavaScript in the Languages > JavaScript “section” and those do work, which is odd.

I’m just about to try the same “**/*.cshtml” exclusion at a global level, so we’ll see how that goes.

Thanks again,

Mike K.

Hello

sorry to jump in

as the HTML SCA is part of OpenSource SonarQube (https://www.sonarqube.org/features/multi-languages/html/), why is it consuming LOC on a Developer (commercial) instance?

One would expect that only languages supported only in paid version (C/C++, …) should impact the LOC.
Actually, we have to deploy 2 SonarQube instances to effectively (from cost perspective) perform SCA on either oss-supported or commercially-supported languages. Which also mean configuring 2 analysis, with relevant exclusions, per project…

Nope, that didn’t work, I’m going to try editing the html suffixes now… I’ve previously removed all but one of them and then renamed that one, but I’m not hopeful.

Hi,

There are multiple places exclusions can be set. If your analysis passes any exclusions in your properties files or on the command line then they’ll override anything set in the UI at project level. Could that be the case? To be sure, you can use sonar.scanner.dumpToFile=filename.txt to see the final properties list analysis operates on.

As a last-ditch, you could also uninstall that analyzer.

 
HTH,
Ann

Hello Ann,

Editing the HTML suffixes didn’t work either; I’ve also unsinstalled the analyser previously, but the files are still counted in a miscellaneous “Web” bucket.

However, I’m going to try the dumpToFile setting,and I’ll have a good look at that.

Thank you you for your continued assistance :slight_smile:

Mike K.

Right, deleting a recreating the project has corrected the file LOC count, along with deleting all the HTML rules apart from one (not needed at the moment).

Ta all.