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

community: cleanup code, reduce complexity, add make targets #368

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dhiller
Copy link
Contributor

@dhiller dhiller commented Dec 11, 2024

What this PR does / why we need it:

Reduces complexity in:

  • validators/cmd/sigs-validator
  • generators/cmd/devstats

Adds make targets:

  • lint - will run golangci-lint, additionally gocyclo with > 10
  • test - will run go tests

/kind cleanup
/wg code-quality

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

@kubevirt-bot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. wg/code-quality Denotes an issue or PR that relates to the code-quality working group. labels Dec 11, 2024
@kubevirt-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign rmohr for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Adds a make target `lint` that will be used to run enabled linters,
which are configured via .golangci.yaml .

Initially only the default linters are enabled, additionally the
gocyclo linter with ccn > 10.

Signed-off-by: Daniel Hiller <[email protected]>
Adds a `test` target to the Makefile that executes the go tests.

Signed-off-by: Daniel Hiller <[email protected]>
Adds unit tests for sig validation as precondition of refactoring.

Signed-off-by: Daniel Hiller <[email protected]>
* reduce complexity by converting all groups into a single map
* replace if then with early return
* extract validateLeads, use that in two places

Signed-off-by: Daniel Hiller <[email protected]>
@dhiller dhiller marked this pull request as ready for review December 12, 2024 13:28
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 12, 2024
dhiller added a commit to dhiller/project-infra that referenced this pull request Dec 12, 2024
Based on PR kubevirt/community#368
where new make targets test and lint are introduced we are adding new
presubmit jobs that execute them.

Signed-off-by: Daniel Hiller <[email protected]>
Signed-off-by: Daniel Hiller <[email protected]>
dhiller added a commit to dhiller/project-infra that referenced this pull request Dec 13, 2024
Based on PR kubevirt/community#368
where new make targets test, lint and coverage are introduced we are
adding new presubmit jobs that execute them.

Signed-off-by: Daniel Hiller <[email protected]>
@aburdenthehand
Copy link
Member

/cc @EdDev for wg-code-quality

@kubevirt-bot kubevirt-bot requested a review from EdDev December 16, 2024 09:20
@kubevirt-bot
Copy link

@aburdenthehand: GitHub didn't allow me to request PR reviews from the following users: for.

Note that only kubevirt members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @EdDev for wg-code-quality

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-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XL wg/code-quality Denotes an issue or PR that relates to the code-quality working group.
Projects
Status: Needs review
Development

Successfully merging this pull request may close these issues.

3 participants