-
Notifications
You must be signed in to change notification settings - Fork 162
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
refactor(cmd): reduce complexity of Server Run command #1605
refactor(cmd): reduce complexity of Server Run command #1605
Conversation
Hi @adriantam , I've noticed that in .golangci.yaml the min-complexity is currently set to 58. Checking whole project, top 3 worst cyclomatic complexity scores are
I'm curious if it would be reasonable for the team to reduce this number or if there are reasons for keeping it that way. Thanks for sharing. |
Yes, we should reduce the allowed complexity going forward |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1605 +/- ##
==========================================
- Coverage 86.39% 86.26% -0.12%
==========================================
Files 86 86
Lines 8224 8244 +20
==========================================
+ Hits 7104 7111 +7
- Misses 789 798 +9
- Partials 331 335 +4 ☔ View full report in Codecov by Sentry. |
Heads-up to reviewers! This change is a tiny bit risky. We have no test coverage for the |
HI @adriantam ,
But I have several questions regarding the approach:
Thanks for your support |
29d1135
to
655edfd
Compare
Did more research to self answer my questions
Only adding test for playground refactor to share code and make it easier to review.
I found that timeout should be 15mins based on: openfga/.github/workflows/pull_request.yaml Lines 30 to 32 in aa623fb
I will push to see the outcome and avoid wasting other people time. If there's an easy way to share, happy to know it. |
655edfd
to
57dd34c
Compare
OpenFGA Team, |
PR to reduce cyclomatic complexity for Run function inside cmd/run/run.go
CC: Cyclomatic Complexity
MI: Maintainability Index
(*ServerContext).Run function metrics:
Resolves #1575
Description
I've refactored the code to delegate in sub-functions the dial to GRPC, and the logic for starting HTTP Server + Playground.
References
Resolves #1575
Review Checklist
main