Skip to main content
GET
/
gh
/
{ownerKeyOrId}
/
projects
/
{projectKeyOrId}
/
components
/
{componentIdOrName}
/
metrics
Get component metrics
curl --request GET \
  --url https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/components/{componentIdOrName}/metrics \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "key": "CMPLX",
      "name": "Cognitive Complexity",
      "description": "Total cognitive complexity across all functions",
      "category": "maintainability",
      "value": 128,
      "inverted": true
    },
    {
      "key": "MNT",
      "name": "Maintainability Rating",
      "description": "Letter grade based on technical debt ratio",
      "category": "maintainability",
      "value": "A",
      "inverted": true
    },
    {
      "key": "COV",
      "name": "Coverage Rating",
      "description": "Letter grade based on test coverage",
      "category": "coverage",
      "value": "B",
      "inverted": true
    },
    {
      "key": "LCOV",
      "name": "Line Coverage",
      "description": "Percentage of lines covered by tests",
      "category": "coverage",
      "value": 78.4,
      "inverted": false
    },
    {
      "key": "LOC",
      "name": "Lines of Code",
      "description": "Total lines of code",
      "category": "size",
      "value": 1204,
      "inverted": false
    },
    {
      "key": "FILES",
      "name": "Files",
      "description": "Number of files in the component",
      "category": "size",
      "value": 42,
      "inverted": false
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.qlty.sh/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Generate an API token at https://qlty.sh/user/settings/tokens

Path Parameters

ownerKeyOrId
string
required

The key or ID of the Workspace that owns the Project

projectKeyOrId
string
required

The key or ID of the Project

componentIdOrName
string
required

The ID or name of the Component to retrieve metrics for

Response

Successful response

data
object[]
required

List of Metric items returned in the response