Support for additional file types in line counts?

Hey all,

My team use SonarQube 8.9.9 Community Edition and we’re trying to get a view of how big our codebase is across the various projects Sonar’s analyzing using its metrics.

The problem I’m facing is that while the metrics are easily recognizing all our Java/Typescript/HTML/XML/etc. files, it’s ignoring the properties files and CSVs that I’d like included in the numbers (they’re how we do a lot of important configuration).

I’ve been doing some reading and it sounds like each of Sonar’s supported languages is backed by an analyzer that’s responsible for both the static analysis of the files and pulling out any/all metrics, like the one for Java: GitHub - SonarSource/sonar-java: SonarSource Static Analyzer for Java Code Quality and Security. You therefore can’t just add the .csv or .properties file extension to an existing analyzer as it won’t match the formal language definition and applying Java syntax/semantics to a CSV file would cause issues.

Is that right? If so, is there some faux language analyzer out there that just basic metrics like line counts? My google-fu must be off today, as I keep ending up in holes about the Sonar properties file for configuring your parameters or exporting results as CSVs.

If anybody could help point me in the right direction I’d appreciate it,


Welcome to the community!

Since we charge commercial instances based on lines of code under analysis, we only count the lines we can analyze. (Otherwise it looks like we’re trying to cheat :sweat_smile:).

Your best bet is to count these non-source files outside of SonarQube, e.g. in bash you can use wc -l.


Cheers Ann,

I was hoping to avoid having to do it outside of Sonar as that’d complicate the whole process, but it sounds like that’s the easiest way.

I’ll take another look at the 3rd party plugin support, but from looking the other day I couldn’t see anything generic that would let me feed in arbitrary file types like I was aspiring for.

1 Like

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