Skip to content

refactor(grouper): align pkg/common/grouper with KHI coding rules - #1323

Open
kyasbal wants to merge 1 commit into
mainfrom
push-ytonxmxoovwq
Open

kyasbal wants to merge 1 commit into
mainfrom
push-ytonxmxoovwq

Conversation

@kyasbal

@kyasbal kyasbal commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

Aligns pkg/common/grouper with KHI Go coding and testing conventions without changing exported APIs:

  • Simplifies (*BasicGrouper).Group in pkg/common/grouper/basic.go by renaming loop variable v to element and removing the redundant missing-key empty-slice pre-initialization before append, eliminating a surviving mutant, avoiding an extra map lookup/write per distinct key, and avoiding phantom empty-slice entries for non-reflexive (NaN) keys.
  • Updates pkg/common/grouper/basic_test.go with a GoDoc comment on TestBasicGrouper, scenario comments on all table cases, AAA spacing, idiomatic basicGrouper/want/got identifiers, and boundary cases for nil input and empty-string keys.

Verification

  • make pre-push — PASS (0 mustfix, 0 advisory, 0 skipped)
  • make qa-all-advisory CODEQUALITY_SIMILARITY=true — PASS (0 mustfix, 0 advisory, 0 skipped; 0 similarity advisories)
  • go test -race -count=1 -cover ./pkg/common/grouper/... — PASS (100.0% statement coverage)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies the Group method in BasicGrouper by directly appending elements to the map slices, leveraging Go's built-in support for appending to nil slices. Additionally, the unit tests in basic_test.go have been expanded to cover nil inputs and empty string keys, and the test variables have been refactored to use standard Go naming conventions (want/got). There are no review comments, and the changes look clean and correct, so I have no feedback to provide.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Go Quality Report (origin/main) — ✅ PASS

Metric Result
Changed Scope 1 prod file(s), 1 test file(s), 2 unit(s)
Patch Coverage 100.0% (3/3 lines)
Mutation Score 100.0% (1/1 killed, 0 survived)

Commit: ecc68c2065d9 · Cloud Build Logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant