From 2814d2285af804cbff2275bb789721d7c1391d3c Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 8 Mar 2023 15:30:25 +0000 Subject: [PATCH] Make `str` variable names longer - Three characters is the RuboCop limit for parameter names, but more descriptive is good. - Requested in https://github.com/Homebrew/brew/pull/14922#pullrequestreview-1330848594, but the automerge was too quick for me to get to it. --- Library/Homebrew/formula_text_auditor.rb | 4 ++-- Library/Homebrew/utils/formatter.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/formula_text_auditor.rb b/Library/Homebrew/formula_text_auditor.rb index 23a6eca104..1b8cf9059b 100644 --- a/Library/Homebrew/formula_text_auditor.rb +++ b/Library/Homebrew/formula_text_auditor.rb @@ -23,8 +23,8 @@ module Homebrew other =~ @text end - def include?(str) - @text.include? str + def include?(string) + @text.include? string end def to_s diff --git a/Library/Homebrew/utils/formatter.rb b/Library/Homebrew/utils/formatter.rb index fedd5fd490..3b7caae2b3 100644 --- a/Library/Homebrew/utils/formatter.rb +++ b/Library/Homebrew/utils/formatter.rb @@ -50,14 +50,14 @@ module Formatter # so we always wrap one word before an option. # @see https://github.com/Homebrew/brew/pull/12672 # @see https://macromates.com/blog/2006/wrapping-text-with-regular-expressions/ - def format_help_text(str, width: 172) + def format_help_text(string, width: 172) desc = OPTION_DESC_WIDTH indent = width - desc - str.gsub(/(?<=\S) *\n(?=\S)/, " ") - .gsub(/([`>)\]]:) /, "\\1\n ") - .gsub(/^( +-.+ +(?=\S.{#{desc}}))(.{1,#{desc}})( +|$)(?!-)\n?/, "\\1\\2\n#{" " * indent}") - .gsub(/^( {#{indent}}(?=\S.{#{desc}}))(.{1,#{desc}})( +|$)(?!-)\n?/, "\\1\\2\n#{" " * indent}") - .gsub(/(.{1,#{width}})( +|$)(?!-)\n?/, "\\1\n") + string.gsub(/(?<=\S) *\n(?=\S)/, " ") + .gsub(/([`>)\]]:) /, "\\1\n ") + .gsub(/^( +-.+ +(?=\S.{#{desc}}))(.{1,#{desc}})( +|$)(?!-)\n?/, "\\1\\2\n#{" " * indent}") + .gsub(/^( {#{indent}}(?=\S.{#{desc}}))(.{1,#{desc}})( +|$)(?!-)\n?/, "\\1\\2\n#{" " * indent}") + .gsub(/(.{1,#{width}})( +|$)(?!-)\n?/, "\\1\n") end def url(string)