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

Add api endpoint that expose the list of projects with their license usage

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9.4
    • Component/s: Web API
    • Labels:
      None
    • Edition:
      Developer
    • Production Notes:
      None

      Description

      Implement new endpoint: api/projects/license_usage
      Available only for Admins in DE+
      Only works for Projects, Apps and Portfolios are not taken into account for license usage.

      The supported type of output file is only CSV.

      It returns a list of projects and, for each, the following fields:

      • Project Key
      • Project Name
      • Biggest Branch or PR name
      • Lines of code on the branch/PR:
        We can leverage LiveMeasureDao.sumNclocOfBiggestBranch() for this
      • Lines of Code LOC / Max LOC in the license (license.getMaxLoc()) in %
      • Last Activity Date on the Branch/PR
        Last Analysis can be queried from snapshots table

      Example output file:

      Project Key,Project Name,Branch Name,Lines of code,License usage,Last Active Date
      project-1,Project 1,develop,10000,0.100,2022-03-03T10:48:06.898019
      project-2,Project 2,main,20000,0.100,2022-03-03T10:48:06.898019
      project-3,Project 3,develop,30000,0.100,2022-03-03T10:48:06.898019
      project-4,Project 4,main,40000,0.100,2022-03-03T10:48:06.898019
      project-5,Project 5,develop,50000,0.100,2022-03-03T10:48:06.898019
      

        Attachments

          Activity

            People

            Assignee:
            matteo.mara Matteo Mara
            Reporter:
            mathieu.suen Mathieu Suen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: