Question

I am trying to write a plugin for SonarQube that uses the blame information provided by the SCM-Activity plugin. The problem is that, in Sonar's database, the blame information seems to either be missing or encrypted.

For example, I ran the following query against Sonar's database in MySQL Workbench:

SELECT p.kee, m.name, pm.text_value
FROM sonar.project_measures pm
JOIN sonar.snapshots s on pm.snapshot_id = s.id
JOIN sonar.metrics m on m.id = pm.metric_id
JOIN sonar.projects p on s.project_id = p.id
WHERE s.root_project_id = 1 and m.domain = 'SCM';

Here's a sample of the result:

SCM Query

As you can see, there are four metrics that pertain to the SCM-Activity Plugin for SonarQube:

  • authors_by_line
  • revisions_by_line
  • last_commit_datetimes_by_line
  • scm.hash

So, here are my questions:

  1. Why is it that scm.hash is the only metric that has any value in the column text_value, and the other metrics don't? (I tried the other columns in the project_measures table, and none of them seem to have any values either.)
  2. How do I get useful, decrypted information from the scm.hash metric? Is there a ruby method somewhere that I can use in the front end to get it? (I figure there must be, or how else is SonarQube displaying the blame info when I drill down on lines?)
  3. If there are Ruby methods that allow retrieval and decryption of blame info, they must be located in SonarQube's source code itself, as the SCM-Activity Plugin source code seems to be devoid of any Ruby. If I am right, then where in SonarQube's source code are these Ruby methods located? I've been unable to find them.
Était-ce utile?

La solution

You see NULL values in "text_value" because those metrics need so store more than just a simple line of text. So you have to join the table "MEASURE_DATA" to get the value of those measures.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top