brew style --fix

This commit is contained in:
Mike McQuaid 2022-12-13 10:54:22 +00:00
parent 40f85af824
commit 77c0d38c35
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
27 changed files with 87 additions and 88 deletions

View File

@ -416,7 +416,7 @@ module Cask
add_error "cask token underscores should be replaced by hyphens" if cask.token.include? "_" add_error "cask token underscores should be replaced by hyphens" if cask.token.include? "_"
add_error "cask token should not contain double hyphens" if cask.token.include? "--" add_error "cask token should not contain double hyphens" if cask.token.include? "--"
if cask.token.match?(/[^a-z0-9\-]/) if cask.token.match?(/[^a-z0-9-]/)
add_error "cask token should only contain lowercase alphanumeric characters and hyphens" add_error "cask token should only contain lowercase alphanumeric characters and hyphens"
end end

View File

@ -185,31 +185,31 @@ class URL < Delegator
&block &block
) )
super( super(
if block if block
LazyObject.new do LazyObject.new do
*args = BlockDSL.new(uri, dsl: dsl, &block).call *args = BlockDSL.new(uri, dsl: dsl, &block).call
options = args.last.is_a?(Hash) ? args.pop : {} options = args.last.is_a?(Hash) ? args.pop : {}
uri = T.let(args.first, T.any(URI::Generic, String)) uri = T.let(args.first, T.any(URI::Generic, String))
DSL.new(uri, **options) DSL.new(uri, **options)
end
else
DSL.new(
T.must(uri),
verified: verified,
using: using,
tag: tag,
branch: branch,
revisions: revisions,
revision: revision,
trust_cert: trust_cert,
cookies: cookies,
referer: referer,
header: header,
user_agent: user_agent,
data: data,
only_path: only_path,
)
end end
else
DSL.new(
T.must(uri),
verified: verified,
using: using,
tag: tag,
branch: branch,
revisions: revisions,
revision: revision,
trust_cert: trust_cert,
cookies: cookies,
referer: referer,
header: header,
user_agent: user_agent,
data: data,
only_path: only_path,
)
end
) )
@from_block = !block.nil? @from_block = !block.nil?

View File

@ -200,7 +200,7 @@ module Homebrew
except: args.except, except: args.except,
spdx_license_data: spdx_license_data, spdx_license_data: spdx_license_data,
spdx_exception_data: spdx_exception_data, spdx_exception_data: spdx_exception_data,
style_offenses: style_offenses ? style_offenses.for_path(f.path) : nil, style_offenses: style_offenses&.for_path(f.path),
display_cop_names: args.display_cop_names?, display_cop_names: args.display_cop_names?,
}.compact }.compact

View File

@ -852,7 +852,7 @@ module Homebrew
.gsub("This is an unsupported configuration, likely to break in " \ .gsub("This is an unsupported configuration, likely to break in " \
"the future and leave your machine in an unknown state.", "") "the future and leave your machine in an unknown state.", "")
.gsub("System Integrity Protection status: ", "") .gsub("System Integrity Protection status: ", "")
.delete("\t\.") .delete("\t.")
.capitalize .capitalize
.strip .strip
else else

View File

@ -493,7 +493,7 @@ class FormulaInstaller
# stop installation from continuing. # stop installation from continuing.
opoo <<~EOS opoo <<~EOS
#{formula}: #{e.message} #{formula}: #{e.message}
'conflicts_with \"#{c.name}\"' should be removed from #{formula.path.basename}. 'conflicts_with "#{c.name}"' should be removed from #{formula.path.basename}.
EOS EOS
raise if Homebrew::EnvConfig.developer? raise if Homebrew::EnvConfig.developer?

View File

@ -8,7 +8,6 @@ require "fileutils"
require "json" require "json"
require "json/add/exception" require "json/add/exception"
require "ostruct" require "ostruct"
require "pp"
require "forwardable" require "forwardable"
# Only require "core_ext" here to ensure we're only requiring the minimum of # Only require "core_ext" here to ensure we're only requiring the minimum of

View File

@ -70,7 +70,7 @@ module Homebrew
regex_prefix = Regexp.escape(match[:prefix] || "").gsub("\\-", "-") regex_prefix = Regexp.escape(match[:prefix] || "").gsub("\\-", "-")
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = match[:suffix]&.sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t") suffix = match[:suffix]&.sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
regex_suffix = Regexp.escape(suffix || "").gsub("\\-", "-") regex_suffix = Regexp.escape(suffix || "").gsub("\\-", "-")
# Example directory regex: `%r{href=["']?v?(\d+(?:\.\d+)+)/}i` # Example directory regex: `%r{href=["']?v?(\d+(?:\.\d+)+)/}i`

View File

@ -74,7 +74,7 @@ module Homebrew
regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-") regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t") suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-") regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
# Example regexes: # Example regexes:

View File

@ -60,7 +60,7 @@ module Homebrew
regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-") regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t") suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-") regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
# Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i` # Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i`

View File

@ -65,7 +65,7 @@ module Homebrew
values[:url] = "https://pypi.org/project/#{T.must(match[:package_name]).gsub(/%20|_/, "-")}/#files" values[:url] = "https://pypi.org/project/#{T.must(match[:package_name]).gsub(/%20|_/, "-")}/#files"
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, "\.t") suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")
regex_suffix = Regexp.escape(suffix).gsub("\\-", "-") regex_suffix = Regexp.escape(suffix).gsub("\\-", "-")
# Example regex: `%r{href=.*?/packages.*?/example[._-]v?(\d+(?:\.\d+)*(?:[._-]post\d+)?)\.t}i` # Example regex: `%r{href=.*?/packages.*?/example[._-]v?(\d+(?:\.\d+)*(?:[._-]post\d+)?)\.t}i`

View File

@ -202,7 +202,7 @@ class Sandbox
def path_filter(path, type) def path_filter(path, type)
case type case type
when :regex then "regex \#\"#{path}\"" when :regex then "regex #\"#{path}\""
when :subpath then "subpath \"#{expand_realpath(Pathname.new(path))}\"" when :subpath then "subpath \"#{expand_realpath(Pathname.new(path))}\""
when :literal, nil then "literal \"#{expand_realpath(Pathname.new(path))}\"" when :literal, nil then "literal \"#{expand_realpath(Pathname.new(path))}\""
end end

View File

@ -37,7 +37,7 @@ describe Cask::Cmd::Reinstall, :cask do
==> Removing App '.*Caffeine.app' ==> Removing App '.*Caffeine.app'
==> Dispatching zap stanza ==> Dispatching zap stanza
==> Trashing files: ==> Trashing files:
.*org\.example\.caffeine\.plist .*org.example.caffeine.plist
==> Removing all staged versions of Cask 'local-caffeine' ==> Removing all staged versions of Cask 'local-caffeine'
==> Installing Cask local-caffeine ==> Installing Cask local-caffeine
==> Moving App 'Caffeine.app' to '.*Caffeine.app' ==> Moving App 'Caffeine.app' to '.*Caffeine.app'

View File

@ -51,7 +51,7 @@ describe Homebrew::Livecheck do
livecheck do livecheck do
url "https://formulae.brew.sh/api/formula/ruby.json" url "https://formulae.brew.sh/api/formula/ruby.json"
regex(/"stable":"(\d+(?:\.\d+)+)"/i) regex(/"stable":"(\d+(?:.\d+)+)"/i)
end end
end end
RUBY RUBY
@ -227,7 +227,7 @@ describe Homebrew::Livecheck do
livecheck do livecheck do
url "https://formulae.brew.sh/api/formula/ruby.json" url "https://formulae.brew.sh/api/formula/ruby.json"
regex(/"stable":"(\d+(?:\.\d+)+)"/i) regex(/"stable":"(\d+(?:.\d+)+)"/i)
end end
end end
RUBY RUBY

View File

@ -17,14 +17,14 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do cask 'foo' do
desc 'A bar program' desc 'A bar program'
^ Description shouldn\'t start with an article. ^ Description shouldn't start with an article.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo' do cask 'foo' do
desc 'The bar program' desc 'The bar program'
^^^ Description shouldn\'t start with an article. ^^^ Description shouldn't start with an article.
end end
RUBY RUBY
@ -46,28 +46,28 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foobar' do cask 'foobar' do
desc 'Foo-Bar program' desc 'Foo-Bar program'
^^^^^^^ Description shouldn\'t start with the cask name. ^^^^^^^ Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Foo bar program' desc 'Foo bar program'
^^^^^^^ Description shouldn\'t start with the cask name. ^^^^^^^ Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Foo-Bar program' desc 'Foo-Bar program'
^^^^^^^ Description shouldn\'t start with the cask name. ^^^^^^^ Description shouldn't start with the cask name.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Foo Bar' desc 'Foo Bar'
^^^^^^^ Description shouldn\'t start with the cask name. ^^^^^^^ Description shouldn't start with the cask name.
end end
RUBY RUBY
end end
@ -76,28 +76,28 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'macOS status bar monitor' desc 'macOS status bar monitor'
^^^^^ Description shouldn\'t contain the platform. ^^^^^ Description shouldn't contain the platform.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Toggles dark mode on Mac OS Mojave' desc 'Toggles dark mode on Mac OS Mojave'
^^^^^^ Description shouldn\'t contain the platform. ^^^^^^ Description shouldn't contain the platform.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Better input source switcher for OS X' desc 'Better input source switcher for OS X'
^^^^ Description shouldn\'t contain the platform. ^^^^ Description shouldn't contain the platform.
end end
RUBY RUBY
expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb" expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
cask 'foo-bar' do cask 'foo-bar' do
desc 'Media Manager for Mac OS X' desc 'Media Manager for Mac OS X'
^^^^^^^^ Description shouldn\'t contain the platform. ^^^^^^^^ Description shouldn't contain the platform.
end end
RUBY RUBY
@ -110,7 +110,7 @@ describe RuboCop::Cop::Cask::Desc do
expect_offense <<~RUBY expect_offense <<~RUBY
cask 'foo' do cask 'foo' do
desc 'Application for managing macOS virtual machines on macOS' desc 'Application for managing macOS virtual machines on macOS'
^^^^^ Description shouldn\'t contain the platform. ^^^^^ Description shouldn't contain the platform.
end end
RUBY RUBY

View File

@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do
url "https://brew.sh/foo-1.0.tgz" url "https://brew.sh/foo-1.0.tgz"
def caveats def caveats
"setuid" "setuid"
^^^^^^^^ Don\'t recommend setuid in the caveats, suggest sudo instead. ^^^^^^^^ Don't recommend setuid in the caveats, suggest sudo instead.
end end
end end
RUBY RUBY

View File

@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
livecheck do livecheck do
^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5) ^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5)
url "https://brew.sh/foo/versions/" url "https://brew.sh/foo/versions/"
regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/) regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
end end
end end
RUBY RUBY
@ -75,7 +75,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
livecheck do livecheck do
url "https://brew.sh/foo/versions/" url "https://brew.sh/foo/versions/"
regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/) regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
end end
bottle :unneeded bottle :unneeded

View File

@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'An aardvark' desc 'An aardvark'
^^ Description shouldn\'t start with an article. ^^ Description shouldn't start with an article.
end end
RUBY RUBY
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'The aardvark' desc 'The aardvark'
^^^ Description shouldn\'t start with an article. ^^^ Description shouldn't start with an article.
end end
RUBY RUBY
end end
@ -113,7 +113,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
desc 'Foo is a foobar' desc 'Foo is a foobar'
^^^ Description shouldn\'t start with the formula name. ^^^ Description shouldn't start with the formula name.
end end
RUBY RUBY
end end

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :automake depends_on :automake
^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be \"automake\". ^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be "automake".
end end
RUBY RUBY
end end
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :autoconf depends_on :autoconf
^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be \"autoconf\". ^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be "autoconf".
end end
RUBY RUBY
end end
@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :libtool depends_on :libtool
^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be \"libtool\". ^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be "libtool".
end end
RUBY RUBY
end end
@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
class Foo < Formula class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on :apr depends_on :apr
^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be \"apr-util\". ^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be "apr-util".
end end
RUBY RUBY
end end

View File

@ -15,7 +15,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
system "foo bar" system "foo bar"
^^^^^^^^^ Separate `system` commands into `\"foo\", \"bar\"` ^^^^^^^^^ Separate `system` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -34,7 +34,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
system "\#{bin}/foo bar" system "\#{bin}/foo bar"
^^^^^^^^^^^^^^^^ Separate `system` commands into `\"\#{bin}/foo\", \"bar\"` ^^^^^^^^^^^^^^^^ Separate `system` commands into `"\#{bin}/foo", "bar"`
end end
end end
RUBY RUBY
@ -83,7 +83,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read("foo bar") Utils.popen_read("foo bar")
^^^^^^^^^ Separate `Utils.popen_read` commands into `\"foo\", \"bar\"` ^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -102,7 +102,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.safe_popen_read("foo bar") Utils.safe_popen_read("foo bar")
^^^^^^^^^ Separate `Utils.safe_popen_read` commands into `\"foo\", \"bar\"` ^^^^^^^^^ Separate `Utils.safe_popen_read` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -121,7 +121,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_write("foo bar") Utils.popen_write("foo bar")
^^^^^^^^^ Separate `Utils.popen_write` commands into `\"foo\", \"bar\"` ^^^^^^^^^ Separate `Utils.popen_write` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -140,7 +140,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.safe_popen_write("foo bar") Utils.safe_popen_write("foo bar")
^^^^^^^^^ Separate `Utils.safe_popen_write` commands into `\"foo\", \"bar\"` ^^^^^^^^^ Separate `Utils.safe_popen_write` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -159,7 +159,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read("\#{bin}/foo bar") Utils.popen_read("\#{bin}/foo bar")
^^^^^^^^^^^^^^^^ Separate `Utils.popen_read` commands into `\"\#{bin}/foo\", \"bar\"` ^^^^^^^^^^^^^^^^ Separate `Utils.popen_read` commands into `"\#{bin}/foo", "bar"`
end end
end end
RUBY RUBY
@ -198,7 +198,7 @@ module RuboCop
class Foo < Formula class Foo < Formula
def install def install
Utils.popen_read({ "SHELL" => "bash"}, "foo bar") Utils.popen_read({ "SHELL" => "bash"}, "foo bar")
^^^^^^^^^ Separate `Utils.popen_read` commands into `\"foo\", \"bar\"` ^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"`
end end
end end
RUBY RUBY
@ -222,7 +222,7 @@ module RuboCop
expect_offense(<<~RUBY) expect_offense(<<~RUBY)
fork do fork do
exec "foo bar > output" exec "foo bar > output"
^^^^^^^^^^^^^^^^^^ Don\'t use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`. ^^^^^^^^^^^^^^^^^^ Don't use shell metacharacters in `exec`. Implement the logic in Ruby instead, using methods like `$stdout.reopen`.
end end
RUBY RUBY
end end

View File

@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
FileUtils.mv "hello" FileUtils.mv "hello"
^^^^^^^^^^^^^^^^^^^^ Don\'t need \'FileUtils.\' before mv ^^^^^^^^^^^^^^^^^^^^ Don't need 'FileUtils.' before mv
end end
RUBY RUBY
end end
@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
inreplace "foo" do |longvar| inreplace "foo" do |longvar|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \"inreplace <filenames> do |s|\" is preferred over \"|longvar|\". ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "inreplace <filenames> do |s|" is preferred over "|longvar|".
somerandomCall(longvar) somerandomCall(longvar)
end end
end end
@ -275,7 +275,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def install def install
ENV["COMPILER_PATH"] = "/usr/bin/gcc" ENV["COMPILER_PATH"] = "/usr/bin/gcc"
^^^^^^^^^^^^^^ Use \"\#{ENV.cc}\" instead of hard-coding \"gcc\" ^^^^^^^^^^^^^^ Use "\#{ENV.cc}" instead of hard-coding "gcc"
end end
end end
RUBY RUBY
@ -339,7 +339,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
depends_on "lpeg" => :lua51 depends_on "lpeg" => :lua51
^^^^^^ lua modules should be vendored rather than use deprecated `depends_on \"lpeg\" => :lua51` ^^^^^^ lua modules should be vendored rather than use deprecated `depends_on "lpeg" => :lua51`
end end
RUBY RUBY
end end
@ -413,7 +413,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
desc "foo" desc "foo"
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
needs :openmp needs :openmp
^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on \"gcc\"' ^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on "gcc"'
end end
RUBY RUBY
end end

View File

@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if build.without? "--without-bar" return if build.without? "--without-bar"
^^^^^^^^^^^^^^^ Don't duplicate 'without': Use `build.without? \"bar\"` to check for \"--without-bar\" ^^^^^^^^^^^^^^^ Don't duplicate 'without': Use `build.without? "bar"` to check for "--without-bar"
end end
end end
RUBY RUBY
@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
url 'https://brew.sh/foo-1.0.tgz' url 'https://brew.sh/foo-1.0.tgz'
def post_install def post_install
return if build.with? "--with-bar" return if build.with? "--with-bar"
^^^^^^^^^^^^ Don't duplicate 'with': Use `build.with? \"bar\"` to check for \"--with-bar\" ^^^^^^^^^^^^ Don't duplicate 'with': Use `build.with? "bar"` to check for "--with-bar"
end end
end end
RUBY RUBY

View File

@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "xcodebuild", "foo", "bar" system "xcodebuild", "foo", "bar"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use \"xcodebuild *args\" instead of \"system 'xcodebuild', *args\" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args"
end end
end end
RUBY RUBY
@ -107,7 +107,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "xcodebuild", "foo", "bar" system "xcodebuild", "foo", "bar"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use \"xcodebuild *args\" instead of \"system 'xcodebuild', *args\" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args"
end end
def plist def plist
@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
Formula.factory(name) Formula.factory(name)
^^^^^^^^^^^^^^^^^^^^^ \"Formula.factory(name)\" is deprecated in favor of \"Formula[name]\" ^^^^^^^^^^^^^^^^^^^^^ "Formula.factory(name)" is deprecated in favor of "Formula[name]"
end end
end end
RUBY RUBY
@ -166,7 +166,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "dep", "ensure" system "dep", "ensure"
^^^^^^^^^^^^^^^^^^^^^^ use \"dep\", \"ensure\", \"-vendor-only\" ^^^^^^^^^^^^^^^^^^^^^^ use "dep", "ensure", "-vendor-only"
end end
end end
RUBY RUBY
@ -180,7 +180,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
def install def install
system "cargo", "build" system "cargo", "build"
^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", *std_cargo_args ^^^^^^^^^^^^^^^^^^^^^^^ use "cargo", "install", *std_cargo_args
end end
end end
RUBY RUBY

View File

@ -592,8 +592,8 @@ describe Homebrew::Service do
StandardInput=file:#{HOMEBREW_PREFIX}/var/in/beanstalkd StandardInput=file:#{HOMEBREW_PREFIX}/var/in/beanstalkd
StandardOutput=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.log StandardOutput=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.log
StandardError=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log StandardError=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log
Environment=\"PATH=#{std_path}\" Environment="PATH=#{std_path}"
Environment=\"FOO=BAR\" Environment="FOO=BAR"
EOS EOS
expect(unit).to eq(unit_expect.strip) expect(unit).to eq(unit_expect.strip)
end end

View File

@ -36,7 +36,7 @@ RSpec.shared_context "Homebrew Cask", :needs_macos do # rubocop:disable RSpec/Co
third_party_tap = Tap.fetch("third-party", "tap") third_party_tap = Tap.fetch("third-party", "tap")
begin begin
Cask::Config::DEFAULT_DIRS_PATHNAMES.values.each(&:mkpath) Cask::Config::DEFAULT_DIRS_PATHNAMES.each_value(&:mkpath)
Tap.default_cask_tap.tap do |tap| Tap.default_cask_tap.tap do |tap|
FileUtils.mkdir_p tap.path.dirname FileUtils.mkdir_p tap.path.dirname

View File

@ -4,7 +4,7 @@
describe Tty do describe Tty do
describe "::strip_ansi" do describe "::strip_ansi" do
it "removes ANSI escape codes from a string" do it "removes ANSI escape codes from a string" do
expect(described_class.strip_ansi("\033\[36;7mhello\033\[0m")).to eq("hello") expect(described_class.strip_ansi("\033[36;7mhello\033[0m")).to eq("hello")
end end
end end

View File

@ -535,7 +535,7 @@ module GitHub
response = create_fork(tap_remote_repo, org: org) response = create_fork(tap_remote_repo, org: org)
# GitHub API responds immediately but fork takes a few seconds to be ready. # GitHub API responds immediately but fork takes a few seconds to be ready.
sleep 1 until check_fork_exists(tap_remote_repo, org: org) sleep 1 until check_fork_exists(tap_remote_repo, org: org)
remote_url = if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*") remote_url = if system("git", "config", "--local", "--get-regexp", "remote..*.url", "git@github.com:.*")
response.fetch("ssh_url") response.fetch("ssh_url")
else else
url = response.fetch("clone_url") url = response.fetch("clone_url")

View File

@ -220,9 +220,9 @@ module PyPI
pipgrip_output = Utils.popen_read(*command) pipgrip_output = Utils.popen_read(*command)
unless $CHILD_STATUS.success? unless $CHILD_STATUS.success?
odie <<~EOS odie <<~EOS
Unable to determine dependencies for \"#{input_packages.join(" ")}\" because of a failure when running Unable to determine dependencies for "#{input_packages.join(" ")}" because of a failure when running
`#{command.join(" ")}`. `#{command.join(" ")}`.
Please update the resources for \"#{formula.name}\" manually. Please update the resources for "#{formula.name}" manually.
EOS EOS
end end
@ -242,8 +242,8 @@ module PyPI
odie "Unable to resolve some dependencies. Please update the resources for \"#{formula.name}\" manually." odie "Unable to resolve some dependencies. Please update the resources for \"#{formula.name}\" manually."
elsif url.blank? || checksum.blank? elsif url.blank? || checksum.blank?
odie <<~EOS odie <<~EOS
Unable to find the URL and/or sha256 for the \"#{name}\" resource. Unable to find the URL and/or sha256 for the "#{name}" resource.
Please update the resources for \"#{formula.name}\" manually. Please update the resources for "#{formula.name}" manually.
EOS EOS
end end