How can I add a lines of code measure to a project in SonarQube from an external source?

303 views Asked by At

We currently don't have access to the PL/SQL code of each project, but I get a report of the lines of code in the database schemas. I want to add this external measure to my Sonar projects so that I can report from one single source in the end.

I tried to introduce language and sensor classes for it, but that defeats the purpose of these classes, as I don't have the PL/SQL code at hand, as mentioned, just a file with the loc number per project.

I want to add the measure in a way that I see it in other plugins, such as:

context.saveMeasure(inputFile, CoreMetrics.LINES, lines);
context.saveMeasure(inputFile, CoreMetrics.NCLOC, ncLoc);

but I don't have an inputFile, I just have the loc report and the "PL/SQL" language definition class.

I think I should use one of the following methods on the context:

saveMeasure(Measure measure);

or saveMeasure(Metric metric, Double value);

but how do I construct a Measure or a Metric that defines a top level value for lines of code of that language? Can anybody point me into the correct direction? Thanks!

1

There are 1 answers

3
Julien H. - SonarSource Team On BEST ANSWER

SonarQube is about source code analysis. This is not a generic reporting tool. If you don't have source code, then SonarQube is probably not the right tool for you.