-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: project insights resource with hardcoded data #6610
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 2 findings(s) 🚩
- Improving Code Health: 0 findings(s) ✅
- Affected Hotspots: 0 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
🚩 Declining Code Health (highest to lowest):
- Large Method project-controller.ts: ProjectController.constructor
- Code Duplication project-controller.ts
@@ -20,16 +20,14 @@ import { | |||
deprecatedProjectOverviewSchema, | |||
type ProjectDoraMetricsSchema, | |||
projectDoraMetricsSchema, | |||
projectInsightsSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: ProjectController.getDeprecatedProjectOverview,ProjectController.getProjectOverview
Why does this problem occur?
Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health. Read more.
To ignore this warning click here.
this.route({ | ||
method: 'get', | ||
path: '/:projectId/insights', | ||
handler: this.getProjectInsights, | ||
permission: NONE, | ||
middleware: [ | ||
this.openApiService.validPath({ | ||
tags: ['Unstable'], | ||
operationId: 'getProjectInsights', | ||
summary: 'Get an overview of a project insights.', | ||
description: | ||
'This endpoint returns insights into the specified projects stats, health, lead time for changes, feature types used, members and change requests.', | ||
responses: { | ||
200: createResponseSchema('projectInsightsSchema'), | ||
...getStandardResponses(401, 403, 404), | ||
}, | ||
}), | ||
], | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Large Method
ProjectController.constructor increases from 128 to 145 lines of code, threshold = 70
Why does this problem occur?
Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function. Read more.
To ignore this warning click here.
@@ -287,3 +287,15 @@ test('response should include last seen at per environment for multiple environm | |||
|
|||
expect(body.features[1].lastSeenAt).toBe('2023-10-01T12:34:56.000Z'); | |||
}); | |||
|
|||
test('project insights happy path', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smoke test for now
About the changes
Hardcoded data powering this screen:
![Screenshot 2024-03-19 at 16 26 34](https://private-user-images.githubusercontent.com/1394682/314123303-639bd043-d365-4640-952d-ce75fea7def8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzNjA5MzEsIm5iZiI6MTcxODM2MDYzMSwicGF0aCI6Ii8xMzk0NjgyLzMxNDEyMzMwMy02MzliZDA0My1kMzY1LTQ2NDAtOTUyZC1jZTc1ZmVhN2RlZjgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MTRUMTAyMzUxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDk4YzRjM2EwZDJkMDY4ZDg2ZDAxZDc3OWIwMjk4M2ZjNTdmOWIwY2VmNWQ3ZDFjYzQ1NDdlMTdjM2E5ZjEwYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.FxvrlMjhNkCSOotQwkloLAejqpERoQAbshBTCZVDKho)
This PR introduces a new resource (/insights) and corresponding openapi schemas.
Important files
Discussion points