Skip to content
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

Reduce complexity of Parameters() func #3810

Open
mboersma opened this issue Aug 8, 2023 · 10 comments · May be fixed by #4635
Open

Reduce complexity of Parameters() func #3810

mboersma opened this issue Aug 8, 2023 · 10 comments · May be fixed by #4635
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@mboersma
Copy link
Contributor

mboersma commented Aug 8, 2023

/kind bug

What steps did you take and what happened:

The ManagedClusterSpec.Parameters() func is long, with many ifs and nil checks, so it currently exceeds the maximum cyclomatic complexity allowed by the gocyclo linter. We've disabled that linter for this func.

What did you expect to happen:

The func could be refactored to reduce cyclomatic complexity, perhaps by breaking it into multiple funcs. Existing unit test coverage should be preserved (or improved) across the refactor, and the //nolint:gocyclo comment should be removed.

Anything else you would like to add:

You can test locally that your refactoring succeeds with make lint.

Environment:

  • cluster-api-provider-azure version: main
  • Kubernetes version: (use kubectl version): N/A
  • OS (e.g. from /etc/os-release): N/A
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 8, 2023
@mboersma
Copy link
Contributor Author

mboersma commented Aug 8, 2023

/help
/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@mboersma:
This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/help
/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Aug 8, 2023
@mboersma mboersma changed the title Reduce cyclomatic complexity of Parameters() func Reduce complexity of Parameters() func Aug 9, 2023
@mboersma
Copy link
Contributor Author

/priority backlog

@k8s-ci-robot k8s-ci-robot added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Aug 10, 2023
@mboersma
Copy link
Contributor Author

/kind cleanup

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Aug 10, 2023
@mboersma mboersma removed the kind/bug Categorizes issue or PR as related to a bug. label Aug 10, 2023
@lakshkeswani
Copy link
Contributor

/assign

@mboersma
Copy link
Contributor Author

@lakshkeswani can we give you any help with this task?

@lakshkeswani
Copy link
Contributor

@mboersma No Thanks, I have just started to working on it.

@souhardya79
Copy link

I would be happy to work on it... @mboersma

@mboersma
Copy link
Contributor Author

@souhardya79 please do, I assigned you to the task and I'm happy to review any PR.

@bravebeaver
Copy link

bravebeaver commented Mar 8, 2024

/assign

i will give it another try, hopefully just by grouping things into logical blocks

@bravebeaver bravebeaver linked a pull request Mar 11, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

5 participants