Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-4960

Create WS to search for measure filters

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2
    • Component/s: Measures, Web API
    • Labels:
      None

      Description

      Input

      Parameters :

      • filter : id of the measure filter (ex : 123). Mandatory parameter.
      • metrics : list of metric keys (ex : ncloc,complexity).
      • fields : list of fields to display (ex : name, longName, date, links, favourite, measureTrend, measureStatus, measureVariation)
      • pageSize : number of elements to return (ex : 50)
      • page : index of the current page (ex : 2)
      • sort : sort to apply (ex : metric:ncloc or name)
      • asc : true or false

      Example of full URL :

      /measures/search_filter?filter=123&metrics=ncloc,complexity,alert_status&fields=name,longName,date,links,favourite,measureTrends,measureStatus,measureVariation&pageSize=100&page=1&sort=metric:ncloc&asc=false

      Output

      Format :

      • metrics : list of metrics. Will be empty if metrics not found. Unknown metric will not be displayed.
        • name : name of the metric
        • type : used to know how to display it. Possible values : INT, FLOAT, PERCENT, BOOL, STRING, MILLISEC, DATA, LEVEL, DISTRIB, RATING.
        • worstValue : best value of the metric (nothing if null)
        • bestValue : worst value of the metric (nothing if null)
      • components : list of components with measures. Will be empty if no components found.
        • measures : list of found measures. If no measure found on a metric, nothing will be displayed for this metric.
          • val : value of the measure.
          • fval : formatted value of the measure.
          • status : alert status (if asked in the measureFields parameter), possible values : OK, WARN, ERROR.
          • trend : tendency of the measure, possible values : -2, -1, 0, 1, 2.
          • p1, p2, p3, p4, p5 : values for previous period if measureVariation parameter exists.

      If there's no value, nothing is displayed (never display null).

      Example of JSON returned :

      {
        "metrics": {
          "ncloc": {
            "name": "Lines of code",
            "type": "INT"
          },
          "complexity": {
            "name": "Complexity",
            "type": "FLOAT"
          },
          "alert_status": {
            "name": "alert_status",
            "type": "LEVEL"
          }
        },
        "components": [
          {
            "key": "org.codehaus.Sonar",
            "name": "SonarQube",
            "longName": "SonarQube platform",
            "favourite": true,
            "links": [
              {
                "name": "Continuous integration",
                "url": "http://bamboo.ci.codehaus.org/browse/SONAR"
              }
            ],
            "date": "2013-08-10T04:03:51+0200",
            "fdate": "August 10 2013",
            "measures": {
              "ncloc": {
                "val": 5.000,
                "fval": "5",
                "trend": 0,
                "status": "OK",
              },
              "complexity": {
                "val": 2.000,
                "fval": "2",
                "status": "WARN",
                "p2": 1.000
              }
            }
          }
        ],
        "maxResultsReached": true,
        "paging": {
          "pageIndex": 1,
          "pageSize": 100,
          "total": 500,
          "pages": 5
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julien.lancelot Julien Lancelot
              Reporter:
              julien.lancelot Julien Lancelot
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: