Skip to content

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented May 29, 2025

Summary

This PR replaces longform loop expressions with a shorthand range when iterating across integers starting from zero.

No change to functionalities!

Notes

for i := range 1..100 { /* */ }

Requirements

@zimeg zimeg added this to the Next Release milestone May 29, 2025
@zimeg zimeg self-assigned this May 29, 2025
@zimeg zimeg requested a review from a team as a code owner May 29, 2025 17:52
@zimeg zimeg added code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment labels May 29, 2025
@codecov
Copy link

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.48%. Comparing base (662186b) to head (1beaa60).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage   63.48%   63.48%           
=======================================
  Files         212      212           
  Lines       22341    22341           
=======================================
  Hits        14183    14183           
  Misses       7067     7067           
  Partials     1091     1091           

☔ 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.

@mwbrooks mwbrooks modified the milestones: v3.3.0, Next Release May 30, 2025
Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

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

✅ Looks good to me! I never knew that we use the range syntax with a single integer!

@zimeg
Copy link
Member Author

zimeg commented Jun 5, 2025

@mwbrooks I forget which Go release unlocked this, but the great @golangci linter suggested this change to me 🤖✨

I'm glad we have regression tests to confirm this holds too:

func Test_Hook_Execute_V2_GenerateMD5FromRandomString(t *testing.T) {
randomString1 := generateMD5FromRandomString()
randomString2 := generateMD5FromRandomString()
assert.NotEqual(t, randomString1, randomString2)
assert.GreaterOrEqual(t, len(randomString1), 10)
assert.GreaterOrEqual(t, len(randomString2), 10)
}

In ongoing incremental efforts toward improved code health I will merge this once the tests pass 👾

@zimeg zimeg merged commit 6f0afba into main Jun 5, 2025
6 checks passed
@zimeg zimeg deleted the zimeg-refactor-range-loop branch June 5, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants