feat: Add code quality findings support#4330
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
1f70f5b to
2d481e2
Compare
| - name: POST /hub | ||
| documentation_url: https://docs.github.com/webhooks/about-webhooks-for-repositories#pubsubhubbub | ||
| - name: GET /organizations/{organization_id} | ||
| - name: GET /repos/{owner}/{repo}/code-quality/findings |
There was a problem hiding this comment.
This file should not be hand-edited, so you will need to revert the changes to this file.
I'm on my phone now, but tomorrow I can update this file in a separate PR which you can then pull into this PR so we can move forward with it.
There was a problem hiding this comment.
I got confused because one of the CI scripts seems to require this. Maybe I missed something.
2d481e2 to
681fa0f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4330 +/- ##
=======================================
Coverage 97.48% 97.48%
=======================================
Files 193 193
Lines 19400 19440 +40
=======================================
+ Hits 18912 18952 +40
Misses 270 270
Partials 218 218 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
681fa0f to
c87d53b
Compare
| type CodeQualityFinding struct { | ||
| Number *int `json:"number,omitempty"` | ||
| State *string `json:"state,omitempty"` | ||
| URL *string `json:"url,omitempty"` | ||
| Rule *CodeQualityFindingRule `json:"rule,omitempty"` | ||
| Location *CodeQualityFindingLocation `json:"location,omitempty"` | ||
| Message *CodeQualityFindingMessage `json:"message,omitempty"` | ||
| CreatedAt *Timestamp `json:"created_at,omitempty"` | ||
| } |
There was a problem hiding this comment.
Must match the schema:
{
"type": "array",
"items": {
"description": "Code quality finding",
"type": "object",
"properties": {
"number": {
"description": "The finding number.",
"type": "integer"
},
"state": {
"description": "State of the code quality finding.",
"type": "string",
"enum": [
"open",
"dismissed"
]
},
"url": {
"description": "The REST API URL of the code quality finding resource.",
"type": "string",
"format": "uri"
},
"rule": {
"description": "Code quality rule",
"type": "object",
"properties": {
"id": {
"description": "A unique identifier for the rule used to detect the finding.",
"type": "string"
},
"title": {
"description": "The name of the rule used to detect the finding.",
"type": "string"
},
"description": {
"description": "A short description of the rule used to detect the finding.",
"type": "string"
},
"help": {
"description": "A detailed description of the rule used to detect the finding.",
"type": "string"
},
"severity": {
"description": "The severity of the rule used to detect the finding.",
"type": "string",
"enum": [
"error",
"warning",
"note",
"none"
]
},
"category": {
"description": "The category of the rule used to detect the finding.",
"type": "string",
"enum": [
"none",
"maintainability",
"reliability"
]
}
},
"required": [
"id",
"title",
"description",
"severity",
"category"
]
},
"location": {
"description": "Code quality file location",
"type": "object",
"properties": {
"path": {
"description": "The file path where the finding was detected.",
"type": "string"
},
"start_line": {
"description": "The line number where the finding starts.",
"type": "integer"
},
"start_column": {
"description": "The column number where the finding starts.",
"type": "integer"
},
"end_line": {
"description": "The line number where the finding ends.",
"type": "integer"
},
"end_column": {
"description": "The column number where the finding ends.",
"type": "integer"
}
},
"required": [
"path"
]
},
"message": {
"description": "Code quality finding message",
"type": "object",
"properties": {
"text": {
"description": "The message text of the code quality finding.",
"type": "string"
},
"markdown": {
"description": "The message text of the code quality finding in markdown format.",
"type": "string"
}
},
"required": [
"text",
"markdown"
]
},
"created_at": {
"description": "The time the code quality finding was created.",
"type": "string",
"format": "date-time"
}
},
"required": [
"number",
"state",
"url",
"rule",
"location",
"message"
]
}
}
Adds support for the REST Code Quality findings endpoints in go-github.
This includes ListFindings and GetFinding on CodeQualityService, the finding data models, unit tests, generated accessors, a pagination iterator, and manual metadata entries in openapi_operations.yaml so the change stays aligned with the project's documentation and code generation patterns.
Closes: #4327