[Bug Fix] Fix gem linter: remove redundant keyword_init: true

Merged
JA
5mo ago
+10-10

Description

The gem linter (rake standard) is currently failing on main, independent of any feature work. Standard now flags Style/RedundantStructKeywordInit: on Ruby 3.2+ a Struct accepts both positional and keyword arguments, so keyword_init: true is redundant.

Four offenses across three docs Structs:

  • lib/ruby_ui/data_table/data_table_docs.rb:4
  • lib/ruby_ui/table/table_docs.rb:4 and :5
  • lib/ruby_ui/tabs/tabs_docs.rb:4

This PR removes the redundant keyword_init: true. The structs are still instantiated with keyword arguments throughout the docs, which keeps working on the gem's supported Ruby (>= 3.2).

The cop's autocorrect is marked unsafe (it would change behavior on Ruby < 3.2), so standardrb --fix leaves it alone — hence the manual edit.

How to test

cd gem
bundle exec rake standard   # 364 files inspected, no offenses detected
bundle exec rake test       # all green

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes failing linters in both the gem and the docs app by removing redundant keyword_init: true from sample Structs. Ruby 3.2+ accepts keyword args without it, so behavior is unchanged and both linters pass.

  • Bug Fixes
    • Removed keyword_init: true from Row, Invoice, User, and Repo across gem *_docs.rb and docs app components/views.
    • Confirmed keyword instantiation on Ruby >= 3.2; gem and docs linters green, gem tests pass.