Skip to content

Using Rubocop Settings to Standardize String Literals with Double Quotes#516

Open
dearblue wants to merge 1 commit into
mruby:masterfrom
dearblue:rubocop
Open

Using Rubocop Settings to Standardize String Literals with Double Quotes#516
dearblue wants to merge 1 commit into
mruby:masterfrom
dearblue:rubocop

Conversation

@dearblue

Copy link
Copy Markdown
Contributor

When string interpolation is required, string literals must be "converted" to double quotes.
Ultimately, using double quotes consistently from the start ensures greater overall consistency.


I plan to enhance the .check.rb file.

@dearblue dearblue requested a review from matz as a code owner June 13, 2026 01:27

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

Copy link
Copy Markdown

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 updates string literals in .check.rb from single quotes to double quotes, aligning with new RuboCop configuration rules added to .github/linters/.rubocop.yml that enforce double quotes. The review feedback suggests two idiomatic Ruby improvements in .check.rb: simplifying the single-element array inclusion check to a direct equality comparison, and using the safe navigation operator (&.each) instead of .to_a.each to handle potential nil values more cleanly.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread .check.rb
end
raise 'invalid protocol' unless ['git'].include? tree['protocol'] # TODO
raise 'no license' unless tree['license']
raise "invalid protocol" unless ["git"].include? tree["protocol"] # TODO

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using ["git"].include? tree["protocol"] is less efficient and less readable than a direct equality comparison since the array contains only a single element. Simplifying this to tree["protocol"] == "git" is more idiomatic.

  raise "invalid protocol" unless tree["protocol"] == "git" # TODO

Comment thread .check.rb

tree['dependencies'].to_a.each do |x|
raise 'invalid dependencies' unless x.is_a?(String)
tree["dependencies"].to_a.each do |x|

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using .to_a.each to handle a potential nil value is less idiomatic in modern Ruby. Using the safe navigation operator &.each is cleaner and avoids creating an unnecessary empty array when tree["dependencies"] is nil.

  tree["dependencies"]&.each do |x|

When string interpolation is required, string literals must be "converted" to double quotes.
Ultimately, using double quotes consistently from the start ensures greater overall consistency.
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