Api/measures/search_history returns only date history

Hello.

I want to get complexity value of a file over commits. I used api/measures/search_history api to do that. However, what I received is as follows and it just showed analysis date of each commit. I looked into the documentation, but I could not find why the complexity value is not provided.

{
    "paging": {
        "pageIndex": 1,
        "pageSize": 100,
        "total": 843
    },
    "measures": [
        {
            "metric": "complexity",
            "history": [
                {
                    "date": "2018-06-22T01:21:34+0200"
                },
                {
                    "date": "2018-06-22T02:11:39+0200"
                },
...
}

Hi,

Indeed, this web service will return all analysis date, even when the metric is not computed.
In your case, it means that when the metric was not computed for the returned analysis, but it may have been computed for others analysis.

Regards.

Thank you for answer.

I would like to know when the metric is computed.
Actually, I could not see any complexity value across all analysis date. This is weird because the file is JavaScript file and it was modified often (34 times).
I thought that SonarCloud calculates complexity of each changed file every analysis so that complexity of a project can be provided.

Could you please check if the complexity is computed on last analysis ?

Complexity of a project is computed, and I can see its history. However, I cannot see complexity history of a file in the project. I can see only current complexity of the file.
Is there way to see complexity history of a file in the project? api/measures/search_history API does not seem to work for a file. It shows only date history.

Ok now I understand => there’s no bug in the WS, history on files are not kept as it would increase too much the size of the database (see https://docs.sonarqube.org/display/SONAR/Housekeeping for more details on this).

1 Like