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

refactor: Satisfy linter in zonesToRegion #2735

Merged
merged 3 commits into from
Mar 9, 2024

Conversation

e-sumin
Copy link
Contributor

@e-sumin e-sumin commented Mar 8, 2024

Change Overview

There was annotation which disables gocritic. This linter could be enabled now, since we do have test which will detect panic.

Also it fixes order of regions returned by zonesToRegions

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • fixes #issue-number

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Comment on lines -352 to -355
// TODO: gocritic rule below suggests to use regexp.MustCompile but it
// panics if regex cannot be compiled. We should add proper test before
// enabling this below so that no change to this regex results in a panic
r, _ := regexp.Compile("-?[a-z]$") //nolint:gocritic
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code will panic in any case, because error is ignored, and r will be nil in case of wrong regex. So, disabling linter and usage of Compile did not solve the issue with possible panic.

Anyway, now we do have unit test which will detect panic.

@mergify mergify bot mentioned this pull request Mar 8, 2024
10 tasks
@e-sumin
Copy link
Contributor Author

e-sumin commented Mar 8, 2024

I've accidentally pushed original PR under wrong branch name. After renaming branch via GH, it has automatically closed existing PR, so I had to create new one.

Copy link
Contributor

@viveksinghggits viveksinghggits left a comment

Choose a reason for hiding this comment

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

thank you @e-sumin 🙏 .

@e-sumin e-sumin added the kueue label Mar 9, 2024
@mergify mergify bot merged commit 0e6831c into master Mar 9, 2024
14 checks passed
@mergify mergify bot deleted the fix_zone_to_region_converter branch March 9, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants