Skip to content

fix: remove the duplicated instance-name helpers - #168

Merged
tas50 merged 1 commit into
mainfrom
fix/remove-duplicated-name-helpers
Aug 23, 2026
Merged

fix: remove the duplicated instance-name helpers#168
tas50 merged 1 commit into
mainfrom
fix/remove-duplicated-name-helpers

Conversation

@tas50

@tas50 tas50 commented Aug 23, 2026

Copy link
Copy Markdown
Member

The problem

main is red on bundle exec rake:

lib/kitchen/driver/gce.rb:882:7: W: Lint/DuplicateMethods: Method Kitchen::Driver::Gce#max_server_name_length is defined at both lib/kitchen/driver/gce.rb:826 and lib/kitchen/driver/gce.rb:882.
lib/kitchen/driver/gce.rb:898:7: W: Lint/DuplicateMethods: Method Kitchen::Driver::Gce#longest_disk_name ...
lib/kitchen/driver/gce.rb:907:7: W: Lint/DuplicateMethods: Method Kitchen::Driver::Gce#longest_disk_name_suffix ...
lib/kitchen/driver/gce.rb:915:7: W: Lint/DuplicateMethods: Method Kitchen::Driver::Gce#fallback_server_name ...
lib/kitchen/driver/gce.rb:923:7: W: Lint/DuplicateMethods: Method Kitchen::Driver::Gce#fallback_server_name_length ...

Five private helpers are defined twice, byte for byte, comments included.
#162 introduced them and #163 introduced them again; neither merge dropped
the duplicate.

Ruby resolves this by letting the second definition win, so behaviour is
correct and the spec suite has stayed green throughout — which is why it
went unnoticed. Only RuboCop sees it.

The fix

Delete the second copy. This is a pure deletion — git diff adds no lines:

 lib/kitchen/driver/gce.rb | 56 -----------------------------------------------
 1 file changed, 56 deletions(-)

Verification

  • bundle exec rake — 330 examples, 0 failures; 18 files inspected, no offenses.
  • The two copies were confirmed byte-identical before removal, so the surviving
    definitions are the ones that were already in effect at runtime.

`max_server_name_length`, `longest_disk_name`, `longest_disk_name_suffix`,
`fallback_server_name` and `fallback_server_name_length` are each defined
twice, byte for byte. #162 added them and #163 added them again, and
neither merge noticed.

Ruby lets the later definition win silently, so nothing misbehaves and
the suite stays green -- but `rake` does not, because RuboCop flags all
five as Lint/DuplicateMethods, and main has been red since #163 landed.

Delete the second copy. Pure deletion, no behaviour change: 326 examples,
0 failures, no offenses.
@tas50
tas50 force-pushed the fix/remove-duplicated-name-helpers branch from 7f9716b to 8af31f3 Compare August 23, 2026 18:52
@tas50
tas50 merged commit a9dcaf2 into main Aug 23, 2026
3 checks passed
@tas50
tas50 deleted the fix/remove-duplicated-name-helpers branch August 23, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant