brew style --fix
This commit is contained in:
		
							parent
							
								
									40f85af824
								
							
						
					
					
						commit
						77c0d38c35
					
				@ -416,7 +416,7 @@ module Cask
 | 
			
		||||
      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? "--"
 | 
			
		||||
 | 
			
		||||
      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"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -185,31 +185,31 @@ class URL < Delegator
 | 
			
		||||
    &block
 | 
			
		||||
  )
 | 
			
		||||
    super(
 | 
			
		||||
    if block
 | 
			
		||||
      LazyObject.new do
 | 
			
		||||
        *args = BlockDSL.new(uri, dsl: dsl, &block).call
 | 
			
		||||
        options = args.last.is_a?(Hash) ? args.pop : {}
 | 
			
		||||
        uri = T.let(args.first, T.any(URI::Generic, String))
 | 
			
		||||
        DSL.new(uri, **options)
 | 
			
		||||
      if block
 | 
			
		||||
        LazyObject.new do
 | 
			
		||||
          *args = BlockDSL.new(uri, dsl: dsl, &block).call
 | 
			
		||||
          options = args.last.is_a?(Hash) ? args.pop : {}
 | 
			
		||||
          uri = T.let(args.first, T.any(URI::Generic, String))
 | 
			
		||||
          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
 | 
			
		||||
    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?
 | 
			
		||||
 | 
			
		||||
@ -200,7 +200,7 @@ module Homebrew
 | 
			
		||||
        except:              args.except,
 | 
			
		||||
        spdx_license_data:   spdx_license_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?,
 | 
			
		||||
      }.compact
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -852,7 +852,7 @@ module Homebrew
 | 
			
		||||
                 .gsub("This is an unsupported configuration, likely to break in " \
 | 
			
		||||
                       "the future and leave your machine in an unknown state.", "")
 | 
			
		||||
                 .gsub("System Integrity Protection status: ", "")
 | 
			
		||||
                 .delete("\t\.")
 | 
			
		||||
                 .delete("\t.")
 | 
			
		||||
                 .capitalize
 | 
			
		||||
                 .strip
 | 
			
		||||
          else
 | 
			
		||||
 | 
			
		||||
@ -493,7 +493,7 @@ class FormulaInstaller
 | 
			
		||||
      # stop installation from continuing.
 | 
			
		||||
      opoo <<~EOS
 | 
			
		||||
        #{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
 | 
			
		||||
 | 
			
		||||
      raise if Homebrew::EnvConfig.developer?
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,6 @@ require "fileutils"
 | 
			
		||||
require "json"
 | 
			
		||||
require "json/add/exception"
 | 
			
		||||
require "ostruct"
 | 
			
		||||
require "pp"
 | 
			
		||||
require "forwardable"
 | 
			
		||||
 | 
			
		||||
# Only require "core_ext" here to ensure we're only requiring the minimum of
 | 
			
		||||
 | 
			
		||||
@ -70,7 +70,7 @@ module Homebrew
 | 
			
		||||
          regex_prefix = Regexp.escape(match[:prefix] || "").gsub("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # 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("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # Example directory regex: `%r{href=["']?v?(\d+(?:\.\d+)+)/}i`
 | 
			
		||||
 | 
			
		||||
@ -74,7 +74,7 @@ module Homebrew
 | 
			
		||||
          regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # 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("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # Example regexes:
 | 
			
		||||
 | 
			
		||||
@ -60,7 +60,7 @@ module Homebrew
 | 
			
		||||
          regex_prefix = Regexp.escape(T.must(match[:prefix])).gsub("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # 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("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # Example regex: `/href=.*?Brew[._-]v?(\d+(?:\.\d+)*)\.t/i`
 | 
			
		||||
 | 
			
		||||
@ -65,7 +65,7 @@ module Homebrew
 | 
			
		||||
          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)
 | 
			
		||||
          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("\\-", "-")
 | 
			
		||||
 | 
			
		||||
          # Example regex: `%r{href=.*?/packages.*?/example[._-]v?(\d+(?:\.\d+)*(?:[._-]post\d+)?)\.t}i`
 | 
			
		||||
 | 
			
		||||
@ -202,7 +202,7 @@ class Sandbox
 | 
			
		||||
 | 
			
		||||
  def path_filter(path, type)
 | 
			
		||||
    case type
 | 
			
		||||
    when :regex        then "regex \#\"#{path}\""
 | 
			
		||||
    when :regex        then "regex #\"#{path}\""
 | 
			
		||||
    when :subpath      then "subpath \"#{expand_realpath(Pathname.new(path))}\""
 | 
			
		||||
    when :literal, nil then "literal \"#{expand_realpath(Pathname.new(path))}\""
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ describe Cask::Cmd::Reinstall, :cask do
 | 
			
		||||
      ==> Removing App '.*Caffeine.app'
 | 
			
		||||
      ==> Dispatching zap stanza
 | 
			
		||||
      ==> Trashing files:
 | 
			
		||||
      .*org\.example\.caffeine\.plist
 | 
			
		||||
      .*org.example.caffeine.plist
 | 
			
		||||
      ==> Removing all staged versions of Cask 'local-caffeine'
 | 
			
		||||
      ==> Installing Cask local-caffeine
 | 
			
		||||
      ==> Moving App 'Caffeine.app' to '.*Caffeine.app'
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,7 @@ describe Homebrew::Livecheck do
 | 
			
		||||
 | 
			
		||||
        livecheck do
 | 
			
		||||
          url "https://formulae.brew.sh/api/formula/ruby.json"
 | 
			
		||||
          regex(/"stable":"(\d+(?:\.\d+)+)"/i)
 | 
			
		||||
          regex(/"stable":"(\d+(?:.\d+)+)"/i)
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
@ -227,7 +227,7 @@ describe Homebrew::Livecheck do
 | 
			
		||||
 | 
			
		||||
          livecheck do
 | 
			
		||||
            url "https://formulae.brew.sh/api/formula/ruby.json"
 | 
			
		||||
            regex(/"stable":"(\d+(?:\.\d+)+)"/i)
 | 
			
		||||
            regex(/"stable":"(\d+(?:.\d+)+)"/i)
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
 | 
			
		||||
@ -17,14 +17,14 @@ describe RuboCop::Cop::Cask::Desc do
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo' do
 | 
			
		||||
        desc 'A bar program'
 | 
			
		||||
              ^ Description shouldn\'t start with an article.
 | 
			
		||||
              ^ Description shouldn't start with an article.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo' do
 | 
			
		||||
        desc 'The bar program'
 | 
			
		||||
              ^^^ Description shouldn\'t start with an article.
 | 
			
		||||
              ^^^ Description shouldn't start with an article.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
@ -46,28 +46,28 @@ describe RuboCop::Cop::Cask::Desc do
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foobar' do
 | 
			
		||||
        desc 'Foo-Bar program'
 | 
			
		||||
              ^^^^^^^ Description shouldn\'t start with the cask name.
 | 
			
		||||
              ^^^^^^^ Description shouldn't start with the cask name.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'Foo bar program'
 | 
			
		||||
              ^^^^^^^ Description shouldn\'t start with the cask name.
 | 
			
		||||
              ^^^^^^^ Description shouldn't start with the cask name.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'Foo-Bar program'
 | 
			
		||||
              ^^^^^^^ Description shouldn\'t start with the cask name.
 | 
			
		||||
              ^^^^^^^ Description shouldn't start with the cask name.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'Foo Bar'
 | 
			
		||||
              ^^^^^^^ Description shouldn\'t start with the cask name.
 | 
			
		||||
              ^^^^^^^ Description shouldn't start with the cask name.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
  end
 | 
			
		||||
@ -76,28 +76,28 @@ describe RuboCop::Cop::Cask::Desc do
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'macOS status bar monitor'
 | 
			
		||||
              ^^^^^ Description shouldn\'t contain the platform.
 | 
			
		||||
              ^^^^^ Description shouldn't contain the platform.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'Toggles dark mode on Mac OS Mojave'
 | 
			
		||||
                                   ^^^^^^ Description shouldn\'t contain the platform.
 | 
			
		||||
                                   ^^^^^^ Description shouldn't contain the platform.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'Better input source switcher for OS X'
 | 
			
		||||
                                               ^^^^ Description shouldn\'t contain the platform.
 | 
			
		||||
                                               ^^^^ Description shouldn't contain the platform.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
    expect_offense <<~RUBY, "/homebrew-cask/Casks/foo.rb"
 | 
			
		||||
      cask 'foo-bar' do
 | 
			
		||||
        desc 'Media Manager for Mac OS X'
 | 
			
		||||
                                ^^^^^^^^ Description shouldn\'t contain the platform.
 | 
			
		||||
                                ^^^^^^^^ Description shouldn't contain the platform.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
@ -110,7 +110,7 @@ describe RuboCop::Cop::Cask::Desc do
 | 
			
		||||
    expect_offense <<~RUBY
 | 
			
		||||
      cask 'foo' do
 | 
			
		||||
        desc 'Application for managing macOS virtual machines on macOS'
 | 
			
		||||
                                                                 ^^^^^ Description shouldn\'t contain the platform.
 | 
			
		||||
                                                                 ^^^^^ Description shouldn't contain the platform.
 | 
			
		||||
      end
 | 
			
		||||
    RUBY
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@ describe RuboCop::Cop::FormulaAudit::Caveats do
 | 
			
		||||
          url "https://brew.sh/foo-1.0.tgz"
 | 
			
		||||
           def caveats
 | 
			
		||||
            "setuid"
 | 
			
		||||
            ^^^^^^^^ Don\'t recommend setuid in the caveats, suggest sudo instead.
 | 
			
		||||
            ^^^^^^^^ Don't recommend setuid in the caveats, suggest sudo instead.
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
 | 
			
		||||
          livecheck do
 | 
			
		||||
          ^^^^^^^^^^^^ `livecheck` (line 7) should be put before `bottle` (line 5)
 | 
			
		||||
            url "https://brew.sh/foo/versions/"
 | 
			
		||||
            regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/)
 | 
			
		||||
            regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
@ -75,7 +75,7 @@ describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
 | 
			
		||||
 | 
			
		||||
          livecheck do
 | 
			
		||||
            url "https://brew.sh/foo/versions/"
 | 
			
		||||
            regex(/href=.+?foo-(\d+(?:\.\d+)+)\.t/)
 | 
			
		||||
            regex(/href=.+?foo-(\d+(?:.\d+)+).t/)
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          bottle :unneeded
 | 
			
		||||
 | 
			
		||||
@ -85,7 +85,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          desc 'An aardvark'
 | 
			
		||||
                ^^ Description shouldn\'t start with an article.
 | 
			
		||||
                ^^ Description shouldn't start with an article.
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
 | 
			
		||||
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          desc 'The aardvark'
 | 
			
		||||
                ^^^ Description shouldn\'t start with an article.
 | 
			
		||||
                ^^^ Description shouldn't start with an article.
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
@ -113,7 +113,7 @@ describe RuboCop::Cop::FormulaAudit::Desc do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          desc 'Foo is a foobar'
 | 
			
		||||
                ^^^ Description shouldn\'t start with the formula name.
 | 
			
		||||
                ^^^ Description shouldn't start with the formula name.
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          depends_on :automake
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be \"automake\".
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^ :automake is deprecated. Usage should be "automake".
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
@ -22,7 +22,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          depends_on :autoconf
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be \"autoconf\".
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^ :autoconf is deprecated. Usage should be "autoconf".
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          depends_on :libtool
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be \"libtool\".
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^ :libtool is deprecated. Usage should be "libtool".
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Lines do
 | 
			
		||||
        class Foo < Formula
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          depends_on :apr
 | 
			
		||||
          ^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be \"apr-util\".
 | 
			
		||||
          ^^^^^^^^^^^^^^^ :apr is deprecated. Usage should be "apr-util".
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  system "foo bar"
 | 
			
		||||
                         ^^^^^^^^^ Separate `system` commands into `\"foo\", \"bar\"`
 | 
			
		||||
                         ^^^^^^^^^ Separate `system` commands into `"foo", "bar"`
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -34,7 +34,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  system "\#{bin}/foo bar"
 | 
			
		||||
                         ^^^^^^^^^^^^^^^^ Separate `system` commands into `\"\#{bin}/foo\", \"bar\"`
 | 
			
		||||
                         ^^^^^^^^^^^^^^^^ Separate `system` commands into `"\#{bin}/foo", "bar"`
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -83,7 +83,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  Utils.popen_read("foo bar")
 | 
			
		||||
                                   ^^^^^^^^^ Separate `Utils.popen_read` commands into `\"foo\", \"bar\"`
 | 
			
		||||
                                   ^^^^^^^^^ Separate `Utils.popen_read` commands into `"foo", "bar"`
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -102,7 +102,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  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
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -121,7 +121,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  Utils.popen_write("foo bar")
 | 
			
		||||
                                    ^^^^^^^^^ Separate `Utils.popen_write` commands into `\"foo\", \"bar\"`
 | 
			
		||||
                                    ^^^^^^^^^ Separate `Utils.popen_write` commands into `"foo", "bar"`
 | 
			
		||||
                end
 | 
			
		||||
              end
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -140,7 +140,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  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
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -159,7 +159,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  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
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -198,7 +198,7 @@ module RuboCop
 | 
			
		||||
              class Foo < Formula
 | 
			
		||||
                def install
 | 
			
		||||
                  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
 | 
			
		||||
            RUBY
 | 
			
		||||
@ -222,7 +222,7 @@ module RuboCop
 | 
			
		||||
            expect_offense(<<~RUBY)
 | 
			
		||||
              fork do
 | 
			
		||||
                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
 | 
			
		||||
            RUBY
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
 | 
			
		||||
          desc "foo"
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          FileUtils.mv "hello"
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^ Don\'t need \'FileUtils.\' before mv
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^ Don't need 'FileUtils.' before mv
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
@ -24,7 +24,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
 | 
			
		||||
          desc "foo"
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          inreplace "foo" do |longvar|
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \"inreplace <filenames> do |s|\" is preferred over \"|longvar|\".
 | 
			
		||||
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "inreplace <filenames> do |s|" is preferred over "|longvar|".
 | 
			
		||||
            somerandomCall(longvar)
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
@ -275,7 +275,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          def install
 | 
			
		||||
            ENV["COMPILER_PATH"] = "/usr/bin/gcc"
 | 
			
		||||
                                   ^^^^^^^^^^^^^^ Use \"\#{ENV.cc}\" instead of hard-coding \"gcc\"
 | 
			
		||||
                                   ^^^^^^^^^^^^^^ Use "\#{ENV.cc}" instead of hard-coding "gcc"
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
@ -339,7 +339,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
 | 
			
		||||
          desc "foo"
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          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
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
@ -413,7 +413,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
 | 
			
		||||
          desc "foo"
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          needs :openmp
 | 
			
		||||
          ^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on \"gcc\"'
 | 
			
		||||
          ^^^^^^^^^^^^^ 'needs :openmp' should be replaced with 'depends_on "gcc"'
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -110,7 +110,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          def post_install
 | 
			
		||||
            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
 | 
			
		||||
      RUBY
 | 
			
		||||
@ -123,7 +123,7 @@ describe RuboCop::Cop::FormulaAudit::OptionDeclarations do
 | 
			
		||||
          url 'https://brew.sh/foo-1.0.tgz'
 | 
			
		||||
          def post_install
 | 
			
		||||
            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
 | 
			
		||||
      RUBY
 | 
			
		||||
 | 
			
		||||
@ -93,7 +93,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
 | 
			
		||||
 | 
			
		||||
          def install
 | 
			
		||||
            system "xcodebuild", "foo", "bar"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use \"xcodebuild *args\" instead of \"system 'xcodebuild', *args\"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args"
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
@ -107,7 +107,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
 | 
			
		||||
 | 
			
		||||
          def install
 | 
			
		||||
            system "xcodebuild", "foo", "bar"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use \"xcodebuild *args\" instead of \"system 'xcodebuild', *args\"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use "xcodebuild *args" instead of "system 'xcodebuild', *args"
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def plist
 | 
			
		||||
@ -152,7 +152,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
 | 
			
		||||
 | 
			
		||||
          def install
 | 
			
		||||
            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
 | 
			
		||||
      RUBY
 | 
			
		||||
@ -166,7 +166,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
 | 
			
		||||
 | 
			
		||||
          def install
 | 
			
		||||
            system "dep", "ensure"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^ use \"dep\", \"ensure\", \"-vendor-only\"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^ use "dep", "ensure", "-vendor-only"
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
@ -180,7 +180,7 @@ describe RuboCop::Cop::FormulaAudit::Text do
 | 
			
		||||
 | 
			
		||||
          def install
 | 
			
		||||
            system "cargo", "build"
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^^ use \"cargo\", \"install\", *std_cargo_args
 | 
			
		||||
            ^^^^^^^^^^^^^^^^^^^^^^^ use "cargo", "install", *std_cargo_args
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      RUBY
 | 
			
		||||
 | 
			
		||||
@ -592,8 +592,8 @@ describe Homebrew::Service do
 | 
			
		||||
        StandardInput=file:#{HOMEBREW_PREFIX}/var/in/beanstalkd
 | 
			
		||||
        StandardOutput=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.log
 | 
			
		||||
        StandardError=append:#{HOMEBREW_PREFIX}/var/log/beanstalkd.error.log
 | 
			
		||||
        Environment=\"PATH=#{std_path}\"
 | 
			
		||||
        Environment=\"FOO=BAR\"
 | 
			
		||||
        Environment="PATH=#{std_path}"
 | 
			
		||||
        Environment="FOO=BAR"
 | 
			
		||||
      EOS
 | 
			
		||||
      expect(unit).to eq(unit_expect.strip)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@ RSpec.shared_context "Homebrew Cask", :needs_macos do # rubocop:disable RSpec/Co
 | 
			
		||||
    third_party_tap = Tap.fetch("third-party", "tap")
 | 
			
		||||
 | 
			
		||||
    begin
 | 
			
		||||
      Cask::Config::DEFAULT_DIRS_PATHNAMES.values.each(&:mkpath)
 | 
			
		||||
      Cask::Config::DEFAULT_DIRS_PATHNAMES.each_value(&:mkpath)
 | 
			
		||||
 | 
			
		||||
      Tap.default_cask_tap.tap do |tap|
 | 
			
		||||
        FileUtils.mkdir_p tap.path.dirname
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
describe Tty do
 | 
			
		||||
  describe "::strip_ansi" 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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -535,7 +535,7 @@ module GitHub
 | 
			
		||||
    response = create_fork(tap_remote_repo, org: org)
 | 
			
		||||
    # GitHub API responds immediately but fork takes a few seconds to be ready.
 | 
			
		||||
    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")
 | 
			
		||||
    else
 | 
			
		||||
      url = response.fetch("clone_url")
 | 
			
		||||
 | 
			
		||||
@ -220,9 +220,9 @@ module PyPI
 | 
			
		||||
    pipgrip_output = Utils.popen_read(*command)
 | 
			
		||||
    unless $CHILD_STATUS.success?
 | 
			
		||||
      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(" ")}`.
 | 
			
		||||
        Please update the resources for \"#{formula.name}\" manually.
 | 
			
		||||
        Please update the resources for "#{formula.name}" manually.
 | 
			
		||||
      EOS
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -242,8 +242,8 @@ module PyPI
 | 
			
		||||
        odie "Unable to resolve some dependencies. Please update the resources for \"#{formula.name}\" manually."
 | 
			
		||||
      elsif url.blank? || checksum.blank?
 | 
			
		||||
        odie <<~EOS
 | 
			
		||||
          Unable to find the URL and/or sha256 for the \"#{name}\" resource.
 | 
			
		||||
          Please update the resources for \"#{formula.name}\" manually.
 | 
			
		||||
          Unable to find the URL and/or sha256 for the "#{name}" resource.
 | 
			
		||||
          Please update the resources for "#{formula.name}" manually.
 | 
			
		||||
        EOS
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user