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,
      "valueType": "number"
    },
    {
      "key": "MNT",
      "name": "Maintainability Rating",
      "description": "Letter grade based on technical debt ratio",
      "category": "maintainability",
      "value": "A",
      "inverted": true,
      "valueType": "grade"
    },
    {
      "key": "SEC",
      "name": "Security Rating",
      "description": "Overall security rating based on security vulnerabilities",
      "category": "security",
      "value": "A",
      "inverted": true,
      "valueType": "grade"
    },
    {
      "key": "SIZE",
      "name": "Component Size",
      "description": "Overall component size classification",
      "category": "size",
      "value": "S",
      "inverted": false,
      "valueType": "size"
    },
    {
      "key": "TDR",
      "name": "Technical Debt Ratio",
      "description": "Ratio of technical debt to total development cost",
      "category": "maintainability",
      "value": 4.2,
      "inverted": true,
      "valueType": "percentage"
    },
    {
      "key": "COV",
      "name": "Coverage Rating",
      "description": "Letter grade based on test coverage",
      "category": "coverage",
      "value": "B",
      "inverted": true,
      "valueType": "grade"
    },
    {
      "key": "LCOV",
      "name": "Line Coverage",
      "description": "Percentage of lines covered by tests",
      "category": "coverage",
      "value": 78.4,
      "inverted": false,
      "valueType": "percentage"
    },
    {
      "key": "LOC",
      "name": "Lines of Code",
      "description": "Total lines of code",
      "category": "size",
      "value": 1204,
      "inverted": false,
      "valueType": "count"
    },
    {
      "key": "FILES",
      "name": "Files",
      "description": "Number of files in the component",
      "category": "size",
      "value": 42,
      "inverted": false,
      "valueType": "count"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Path Parameters

ownerKeyOrId
string
required

Repository owner name (login) or workspace ID

Minimum string length: 3
Example:

"acme-corp"

projectKeyOrId
string
required

Repository name or project ID

Minimum string length: 3
Example:

"my-repo"

componentIdOrName
string
required

Component ID or name

Minimum string length: 1
Example:

"backend-api"

Response

Retrieve metrics for a component

data
object[]
required