Skip to content

chore: enable all staticcheck rules #8992

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

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

Conversation

mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Jun 1, 2025

Thank you for contributing to Velero!

Please add a summary of your change

Enable staticcheck rules and fixes issues

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

Copy link

codecov bot commented Jun 1, 2025

Codecov Report

Attention: Patch coverage is 63.88889% with 52 lines in your changes missing coverage. Please review.

Project coverage is 59.71%. Comparing base (d2c6b6b) to head (3b84606).

Files with missing lines Patch % Lines
pkg/controller/pod_volume_backup_controller.go 0.00% 8 Missing and 3 partials ⚠️
pkg/controller/pod_volume_restore_controller.go 0.00% 6 Missing ⚠️
pkg/restore/restore.go 68.42% 4 Missing and 2 partials ⚠️
pkg/backup/actions/csi/pvc_action.go 42.85% 2 Missing and 2 partials ⚠️
pkg/backup/backup.go 50.00% 4 Missing ⚠️
pkg/controller/backup_deletion_controller.go 50.00% 1 Missing and 2 partials ⚠️
pkg/cmd/util/output/backup_structured_describer.go 0.00% 2 Missing ⚠️
pkg/controller/restore_controller.go 33.33% 2 Missing ⚠️
pkg/restore/actions/csi/pvc_action.go 50.00% 2 Missing ⚠️
pkg/backup/item_collector.go 85.71% 1 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8992      +/-   ##
==========================================
+ Coverage   59.70%   59.71%   +0.01%     
==========================================
  Files         370      370              
  Lines       40326    40325       -1     
==========================================
+ Hits        24075    24080       +5     
- Misses      14770    14773       +3     
+ Partials     1481     1472       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
@mmorel-35
Copy link
Contributor Author

/kind changelog-not-required

@github-actions github-actions bot added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Jun 1, 2025
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
@mmorel-35 mmorel-35 force-pushed the staticcheck branch 3 times, most recently from 812a0f9 to 4d0f42e Compare June 1, 2025 19:26
@mmorel-35 mmorel-35 marked this pull request as ready for review June 1, 2025 19:31
@mmorel-35 mmorel-35 changed the title chore: enable more staticcheck rules chore: enable all staticcheck rules Jun 1, 2025
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Copy link
Collaborator

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Excellent code quality improvements

This PR successfully enables all remaining staticcheck rules and fixes the resulting issues across 45 files. All changes are purely linter-driven improvements with no logical modifications:

Key improvements:

  • Removes redundant field accesses and method calls
  • Simplifies boolean logic patterns
  • Eliminates unnecessary struct traversals
  • Improves overall code readability

Impact: ✅ No functional changes, pure code quality enhancement
Risk: ✅ Very low - only stylistic improvements
Coverage: ✅ Comprehensive across the codebase

Great work on cleaning up technical debt and improving static analysis coverage!

Approved 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-e2e-2tests kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants