Merge pull request #6036 from MikeMcQuaid/enable-frozen-string-literal

Use FrozenStringLiteralComment instead of flag.
This commit is contained in:
Mike McQuaid 2019-04-22 13:07:08 -07:00 committed by GitHub
commit 0d54978ba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
724 changed files with 1559 additions and 110 deletions

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org"
# installed gems

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class PATH
include Enumerable
extend Forwardable

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
std_trap = trap("INT") { exit! 130 } # no backtrace thanks

View File

@ -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

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# This script is loaded by formula_installer as a separate instance.
# Thrown exceptions are propagated back to the parent process over a pipe

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class BuildEnvironment
def initialize(*settings)
@settings = Set.new(*settings)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class BuildOptions
# @private
def initialize(args, options)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "json"
#

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "hardware"
require "cask/artifact"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/app"
require "cask/artifact/artifact" # generic 'artifact' stanza
require "cask/artifact/binary"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
module Artifact
class AbstractArtifact

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_artifact"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "timeout"
require "utils/user"
@ -92,10 +94,10 @@ module Cask
sleep 1
end
paths = [
"/Library/LaunchAgents/#{service}.plist",
"/Library/LaunchDaemons/#{service}.plist",
+"/Library/LaunchAgents/#{service}.plist",
+"/Library/LaunchDaemons/#{service}.plist",
]
paths.each { |elt| elt.prepend(ENV["HOME"]) } unless with_sudo
paths.each { |elt| elt.prepend(ENV["HOME"]).freeze } unless with_sudo
paths = paths.map { |elt| Pathname(elt) }.select(&:exist?)
paths.each do |path|
command.run!("/bin/rm", args: ["-f", "--", path], sudo: with_sudo)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
require "extend/hash_validator"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/symlinked"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_artifact"
require "extend/hash_validator"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/relocated"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "plist"
require "utils/user"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_flight_block"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_flight_block"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_artifact"
require "extend/hash_validator"
@ -50,7 +52,7 @@ module Cask
private
ALT_NAME_ATTRIBUTE = "com.apple.metadata:kMDItemAlternateNames".freeze
ALT_NAME_ATTRIBUTE = "com.apple.metadata:kMDItemAlternateNames"
# Try to make the asset searchable under the target name. Spotlight
# respects this attribute for many filetypes, but ignores it for App

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_artifact"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/relocated"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_uninstall"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/moved"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/artifact/abstract_uninstall"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/checkable"
require "cask/download"
require "digest"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/download"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
module Cache
module_function

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/cask_loader"
require "cask/config"
require "cask/dsl"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "delegate"
require "cask/topological_hash"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/cask"
require "uri"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "utils/user"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
module Checkable
def errors

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "optparse"
require "shellwords"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative "options"
require "search"
@ -59,8 +61,7 @@ module Cask
if matches.one?
"Did you mean “#{matches.first}”?"
elsif !matches.empty?
"Did you mean one of these?\n"
.concat(Formatter.columns(matches.take(20)))
"Did you mean one of these?\n#{Formatter.columns(matches.take(20))}"
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class AbstractInternalCommand < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Audit < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Cat < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Create < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "system_config"
require "cask/checkable"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Edit < AbstractCommand
@ -10,9 +12,9 @@ module Cask
def run
exec_editor cask_path
rescue CaskUnavailableError => e
reason = e.reason.empty? ? "" : "#{e.reason} "
reason = e.reason.empty? ? +"" : +"#{e.reason} "
reason.concat("Run #{Formatter.identifier("brew cask create #{e.token}")} to create a new Cask.")
raise e.class.new(e.token, reason)
raise e.class.new(e.token, reason.freeze)
end
def cask_path

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/download"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Home < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "json"
require "cask/installer"
@ -104,14 +106,14 @@ module Cask
end
def self.artifact_info(cask)
artifact_output = ohai_title("Artifacts")
artifact_output = ohai_title("Artifacts").dup
cask.artifacts.each do |artifact|
next unless artifact.respond_to?(:install_phase)
next unless DSL::ORDINARY_ARTIFACT_CLASSES.include?(artifact.class)
artifact_output << "\n" << artifact.to_s
end
artifact_output
artifact_output.freeze
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Install < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class InternalHelp < AbstractInternalCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class InternalStanza < AbstractInternalCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class List < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
module Options

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Outdated < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Reinstall < Install

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Style < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Uninstall < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/config"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Cmd
class Zap < AbstractCommand

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "json"
require "extend/hash_validator"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "fileutils"
require "cask/cache"
require "cask/quarantine"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "locale"
require "lazy_object"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class DSL
class Appcast

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class DSL
class Base

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Caveats DSL. Each method should handle output, following the
# convention of at least one trailing blank line so that the user
# can distinguish separate caveats.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "extend/hash_validator"
using HashValidator

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "unpack_strategy"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "rubygems"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/staged"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class DSL
class Preflight < Base

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class DSL
class UninstallPostflight < Base

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "cask/staged"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class DSL
class Version < ::String

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class CaskError < RuntimeError; end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "rubygems"
require "formula_installer"
@ -136,9 +138,10 @@ module Cask
end
def summary
s = ""
s = +""
s << "#{Emoji.install_badge} " if Emoji.enabled?
s << "#{@cask} was successfully #{upgrade? ? "upgraded" : "installed"}!"
s.freeze
end
def download

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "os/mac/version"
module OS

View File

@ -1,6 +1,8 @@
# frozen_string_literal: true
module Cask
module Metadata
METADATA_SUBDIR = ".metadata".freeze
METADATA_SUBDIR = ".metadata"
def metadata_master_container_path
@metadata_master_container_path ||= caskroom_path.join(METADATA_SUBDIR)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
class Pkg
def self.all_matching(regexp, command)

View File

@ -1,9 +1,11 @@
# frozen_string_literal: true
require "development_tools"
module Cask
module Quarantine
module_function
QUARANTINE_ATTRIBUTE = "com.apple.quarantine".freeze
QUARANTINE_ATTRIBUTE = "com.apple.quarantine"
QUARANTINE_SCRIPT = (HOMEBREW_LIBRARY_PATH/"cask/utils/quarantine.swift").freeze

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "utils/user"
module Cask

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "tsort"
# a basic topologically sortable hashmap

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class URL
ATTRIBUTES = [
:using,

View File

@ -1,9 +1,11 @@
# frozen_string_literal: true
require "utils/user"
require "yaml"
require "open3"
require "stringio"
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs".freeze
BUG_REPORTS_URL = "https://github.com/Homebrew/homebrew-cask#reporting-bugs"
module Cask
module Utils

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Cask
module Verify
module_function

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "language/python"
class Caveats
@ -40,7 +42,7 @@ class Caveats
#{f.name} is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX},
because #{f.keg_only_reason.to_s.chomp}.
EOS
end
end.dup
if f.bin.directory? || f.sbin.directory?
s << <<~EOS
@ -118,10 +120,10 @@ class Caveats
#{root_dir}/share/zsh/site-functions
EOS
when :fish
fish_caveats = "fish #{installed.join(" and ")} have been installed to:"
fish_caveats = +"fish #{installed.join(" and ")} have been installed to:"
fish_caveats << "\n #{root_dir}/share/fish/vendor_completions.d" if completion_installed
fish_caveats << "\n #{root_dir}/share/fish/vendor_functions.d" if functions_installed
fish_caveats
fish_caveats.freeze
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Checksum
extend Forwardable

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Cleans a newly installed keg.
# By default:
#

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "utils/bottles"
require "utils/gems"
require "formula"

Some files were not shown because too many files have changed in this diff Show More