From f76b083b919cccdb7ff9578575e957c4b8b4a63f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 19 Apr 2019 15:21:16 +0900 Subject: [PATCH] Use FrozenStringLiteralComment instead of flag. Unfortunately we cannot use `--frozen-string-literal` with Ruby 2.3 due to https://bugs.ruby-lang.org/issues/12031 and our usage of ERB. --- Library/.rubocop.yml | 3 +-- Library/Homebrew/.rubocop.yml | 5 +++++ Library/Homebrew/brew.sh | 5 +---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 48b7093d10..d515d46b3f 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -93,8 +93,7 @@ Style/ConditionalAssignment: Style/Documentation: Enabled: false -# we want to add this slowly and manually -# TODO: add to more files +# don't want this for formulae but re-enabled for Library/Homebrew Style/FrozenStringLiteralComment: Enabled: false diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index c91eaa0f27..416a664bbc 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -117,6 +117,11 @@ Style/DocumentationMethod: Include: - 'Library/Homebrew/formula.rb' +# don't want this for formulae but re-enabled for Library/Homebrew +Style/FrozenStringLiteralComment: + Enabled: true + EnforcedStyle: always + # so many of these in formulae but none in here Style/GuardClause: Enabled: true diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 761738c9ea..ba6592eba5 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -348,9 +348,6 @@ else RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt" fi -# Don't set this for anyone (yet) -unset HOMEBREW_FROZEN_STRING_LITERAL - if [[ -z "$HOMEBREW_RUBY_WARNINGS" ]] then export HOMEBREW_RUBY_WARNINGS="-W0" @@ -502,5 +499,5 @@ else # Unshift command back into argument list (unless argument list was empty). [[ "$HOMEBREW_ARG_COUNT" -gt 0 ]] && set -- "$HOMEBREW_COMMAND" "$@" - { update-preinstall "$@"; exec "$HOMEBREW_RUBY_PATH" $HOMEBREW_FROZEN_STRING_LITERAL $HOMEBREW_RUBY_WARNINGS "$RUBY_DISABLE_OPTIONS" "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; } + { update-preinstall "$@"; exec "$HOMEBREW_RUBY_PATH" $HOMEBREW_RUBY_WARNINGS "$RUBY_DISABLE_OPTIONS" "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; } fi