diff options
Diffstat (limited to 'Library/Homebrew/test/rubocops')
14 files changed, 169 insertions, 169 deletions
diff --git a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb index b1afdc3f9..659750858 100644 --- a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAuditStrict::BottleBlock do context "When auditing Bottle Block" do it "When there is revision in bottle block" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' bottle do @@ -41,7 +41,7 @@ describe RuboCop::Cop::FormulaAuditStrict::BottleBlock do context "When auditing Bottle Block with auto correct" do it "When there is revision in bottle block" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' bottle do @@ -50,7 +50,7 @@ describe RuboCop::Cop::FormulaAuditStrict::BottleBlock do end end EOS - corrected_source = <<-EOS.undent + corrected_source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' bottle do diff --git a/Library/Homebrew/test/rubocops/caveats_cop_spec.rb b/Library/Homebrew/test/rubocops/caveats_cop_spec.rb index 4dbe65cfb..68f79e08a 100644 --- a/Library/Homebrew/test/rubocops/caveats_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/caveats_cop_spec.rb @@ -8,20 +8,19 @@ describe RuboCop::Cop::FormulaAudit::Caveats do context "When auditing caveats" do it "When there is setuid mentioned in caveats" do - source = <<-EOS.undent - class Foo < Formula - homepage "http://example.com/foo" - url "http://example.com/foo-1.0.tgz" - - def caveats - "setuid" + source = <<~EOS + class Foo < Formula + homepage "http://example.com/foo" + url "http://example.com/foo-1.0.tgz" + def caveats + "setuid" + end end - end EOS expected_offenses = [{ message: "Don't recommend setuid in the caveats, suggest sudo instead.", severity: :convention, - line: 6, + line: 5, column: 5, source: source }] diff --git a/Library/Homebrew/test/rubocops/checksum_cop_spec.rb b/Library/Homebrew/test/rubocops/checksum_cop_spec.rb index 2f508bbf5..ab70f2dcf 100644 --- a/Library/Homebrew/test/rubocops/checksum_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/checksum_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do context "When auditing spec checksums" do it "When the checksum is empty" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' stable do @@ -42,7 +42,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do end it "When the checksum is not 64 characters" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' stable do @@ -76,7 +76,7 @@ describe RuboCop::Cop::FormulaAudit::Checksum do end it "When the checksum has invalid chars" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' stable do @@ -116,7 +116,7 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do context "When auditing spec checksums" do it "When the checksum has upper case characters" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' stable do @@ -150,7 +150,7 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do end it "When auditing stable blocks outside spec blocks" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' resource "foo-outside" do @@ -185,7 +185,7 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do context "When auditing checksum with autocorrect" do it "When there is uppercase sha256" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' stable do @@ -200,7 +200,7 @@ describe RuboCop::Cop::FormulaAudit::ChecksumCase do end EOS - corrected_source = <<-EOS.undent + corrected_source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' stable do diff --git a/Library/Homebrew/test/rubocops/class_cop_spec.rb b/Library/Homebrew/test/rubocops/class_cop_spec.rb index 59252587c..3f210af11 100644 --- a/Library/Homebrew/test/rubocops/class_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/class_cop_spec.rb @@ -17,10 +17,10 @@ describe RuboCop::Cop::FormulaAudit::ClassName do }] formulas.each do |formula| - source = <<-EOS.undent - class Foo < #{formula["class"]} - url 'http://example.com/foo-1.0.tgz' - end + source = <<~EOS + class Foo < #{formula["class"]} + url 'http://example.com/foo-1.0.tgz' + end EOS expected_offenses = [{ message: "#{formula["class"]} is deprecated, use Formula instead", @@ -38,12 +38,12 @@ describe RuboCop::Cop::FormulaAudit::ClassName do end it "with deprecated inheritance and autocorrect" do - source = <<-EOS.undent + source = <<~EOS class Foo < AmazonWebServicesFormula url 'http://example.com/foo-1.0.tgz' end EOS - corrected_source = <<-EOS.undent + corrected_source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' end @@ -60,7 +60,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Test do context "When auditing formula" do it "without a test block" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' end diff --git a/Library/Homebrew/test/rubocops/components_order_cop_spec.rb b/Library/Homebrew/test/rubocops/components_order_cop_spec.rb index f093f4927..a4726c001 100644 --- a/Library/Homebrew/test/rubocops/components_order_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/components_order_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do context "When auditing formula components order" do it "When url precedes homepage" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -29,7 +29,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do end it "When `resource` precedes `depends_on`" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "https://example.com/foo-1.0.tgz" @@ -55,7 +55,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do end it "When `test` precedes `plist`" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "https://example.com/foo-1.0.tgz" @@ -82,7 +82,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do end it "When only one of many `depends_on` precedes `conflicts_with`" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula depends_on "autoconf" => :build conflicts_with "visionmedia-watch" @@ -116,13 +116,13 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do context "When auditing formula components order with autocorrect" do it "When url precedes homepage" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" end EOS - correct_source = <<-EOS.undent + correct_source = <<~EOS class Foo < Formula homepage "http://example.com" url "http://example.com/foo-1.0.tgz" @@ -134,7 +134,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do end it "When `resource` precedes `depends_on`" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "https://example.com/foo-1.0.tgz" @@ -145,7 +145,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsOrder do depends_on "openssl" end EOS - correct_source = <<-EOS.undent + correct_source = <<~EOS class Foo < Formula url "https://example.com/foo-1.0.tgz" diff --git a/Library/Homebrew/test/rubocops/components_redundancy_cop_spec.rb b/Library/Homebrew/test/rubocops/components_redundancy_cop_spec.rb index 9fbe15904..e899a9b07 100644 --- a/Library/Homebrew/test/rubocops/components_redundancy_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/components_redundancy_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsRedundancy do context "When auditing formula components common errors" do it "When url outside stable block" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" stable do @@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsRedundancy do end it "When both `head` and `head do` are present" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula head "http://example.com/foo.git" head do @@ -54,7 +54,7 @@ describe RuboCop::Cop::FormulaAuditStrict::ComponentsRedundancy do end it "When both `bottle :modifier` and `bottle do` are present" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" bottle do diff --git a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb index 8874ecc96..40efe8545 100644 --- a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do context "When auditing formula for conflicts with" do it "multiple conflicts_with" do - source = <<-EOS.undent + source = <<~EOS class FooAT20 < Formula url 'http://example.com/foo-2.0.tgz' conflicts_with "mysql", "mariadb", "percona-server", @@ -30,7 +30,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do end it "no conflicts_with" do - source = <<-EOS.undent + source = <<~EOS class FooAT20 < Formula url 'http://example.com/foo-2.0.tgz' desc 'Bar' diff --git a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb index 4816c3b26..0f0189aa8 100644 --- a/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/formula_desc_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAuditStrict::DescLength do context "When auditing formula desc" do it "When there is no desc" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' end @@ -28,7 +28,7 @@ describe RuboCop::Cop::FormulaAuditStrict::DescLength do end it "reports an offense when desc is an empty string" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc '' @@ -49,14 +49,14 @@ describe RuboCop::Cop::FormulaAuditStrict::DescLength do end it "When desc is too long" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'Bar#{"bar" * 29}' end EOS - msg = <<-EOS.undent + msg = <<~EOS Description is too long. "name: desc" should be less than 80 characters. Length is calculated as foo + desc. (currently 95) EOS @@ -73,7 +73,7 @@ describe RuboCop::Cop::FormulaAuditStrict::DescLength do end it "When desc is multiline string" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'Bar#{"bar" * 9}'\ @@ -81,7 +81,7 @@ describe RuboCop::Cop::FormulaAuditStrict::DescLength do end EOS - msg = <<-EOS.undent + msg = <<~EOS Description is too long. "name: desc" should be less than 80 characters. Length is calculated as foo + desc. (currently 98) EOS @@ -104,7 +104,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do context "When auditing formula desc" do it "When wrong \"command-line\" usage in desc" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'command line' @@ -124,7 +124,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do end it "When an article is used in desc" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'An ' @@ -144,7 +144,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do end it "When an lowercase letter starts a desc" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'bar' @@ -164,7 +164,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do end it "When formula name is in desc" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'Foo is a foobar' @@ -184,13 +184,13 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do end it "autocorrects all rules" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc ' an bar: commandline foo ' end EOS - correct_source = <<-EOS.undent + correct_source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' desc 'an bar: command-line' diff --git a/Library/Homebrew/test/rubocops/homepage_cop_spec.rb b/Library/Homebrew/test/rubocops/homepage_cop_spec.rb index 6c7f248ba..be9dddae6 100644 --- a/Library/Homebrew/test/rubocops/homepage_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/homepage_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do context "When auditing homepage" do it "When there is no homepage" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' end @@ -28,7 +28,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do end it "Homepage with ftp" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula homepage "ftp://example.com/foo" url "http://example.com/foo-1.0.tgz" @@ -65,7 +65,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do } formula_homepages.each do |name, homepage| - source = <<-EOS.undent + source = <<~EOS class #{name.capitalize} < Formula homepage "#{homepage}" url "http://example.com/#{name}-1.0.tgz" diff --git a/Library/Homebrew/test/rubocops/lines_cop_spec.rb b/Library/Homebrew/test/rubocops/lines_cop_spec.rb index af816a5a9..7e93bee75 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -25,11 +25,11 @@ describe RuboCop::Cop::FormulaAudit::Lines do }] formulae.each do |formula| - source = <<-EOS.undent - class Foo < Formula - url 'http://example.com/foo-1.0.tgz' - depends_on :#{formula["dependency"]} - end + source = <<~EOS + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + depends_on :#{formula["dependency"]} + end EOS if formula.key?("correct") offense = ":#{formula["dependency"]} is deprecated. Usage should be \"#{formula["correct"]}\"" @@ -57,7 +57,7 @@ describe RuboCop::Cop::FormulaAudit::ClassInheritance do context "When auditing lines" do it "with no space in class inheritance" do - source = <<-EOS.undent + source = <<~EOS class Foo<Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -84,7 +84,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do context "When auditing formulae" do it "with commented cmake call" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -106,7 +106,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do end it "with default template comments" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula # PLEASE REMOVE desc "foo" @@ -128,7 +128,7 @@ describe RuboCop::Cop::FormulaAudit::Comments do end it "with commented out depends_on" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -156,7 +156,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do context "When auditing formulae" do it "with FileUtils" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -178,7 +178,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with long inreplace block vars" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -202,7 +202,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with invalid rebuild" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -227,7 +227,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with OS.linux? check" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -254,7 +254,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with fails_with :llvm" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -282,7 +282,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with def test" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -307,7 +307,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with def options" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -332,7 +332,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with deprecated skip_clean call" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -340,9 +340,9 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end EOS - expected_offenses = [{ message: <<-EOS.undent.chomp, - `skip_clean :all` is deprecated; brew no longer strips symbols - Pass explicit paths to prevent Homebrew from removing empty folders. + expected_offenses = [{ message: <<~EOS.chomp, + `skip_clean :all` is deprecated; brew no longer strips symbols + Pass explicit paths to prevent Homebrew from removing empty folders. EOS severity: :convention, line: 4, @@ -357,7 +357,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with build.universal?" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -381,7 +381,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with a build.universal? exemption reports no offenses" do - source = <<-EOS.undent + source = <<~EOS class Wine < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -396,7 +396,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with ENV.universal_binary" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -420,7 +420,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with an ENV.universal_binary exemption reports no offenses" do - source = <<-EOS.undent + source = <<~EOS class Wine < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -435,7 +435,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with ENV.x11" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -459,7 +459,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with ruby-macho alternatives" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -481,7 +481,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with ruby-macho alternatives audit exempted formula" do - source = <<-EOS.undent + source = <<~EOS class Cctools < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -494,7 +494,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with npm install without language::Node args" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' @@ -516,7 +516,7 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do end it "with npm install without language::Node args in kibana" do - source = <<-EOS.undent + source = <<~EOS class KibanaAT44 < Formula desc "foo" url 'http://example.com/foo-1.0.tgz' diff --git a/Library/Homebrew/test/rubocops/options_cop_spec.rb b/Library/Homebrew/test/rubocops/options_cop_spec.rb index c27389a68..1ed6ee740 100644 --- a/Library/Homebrew/test/rubocops/options_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/options_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAudit::Options do context "When auditing options" do it "32-bit" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' option "32-bit", "with 32-bit" @@ -35,7 +35,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Options do context "When auditing options strictly" do it "with universal" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' option :universal @@ -56,7 +56,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Options do end it "with deprecated options" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' option :cxx11 @@ -80,7 +80,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Options do end it "with misc deprecated options" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' option "without-check" @@ -109,7 +109,7 @@ describe RuboCop::Cop::NewFormulaAudit::Options do context "When auditing options for a new formula" do it "with deprecated options" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' deprecated_option "examples" => "with-examples" diff --git a/Library/Homebrew/test/rubocops/patches_cop_spec.rb b/Library/Homebrew/test/rubocops/patches_cop_spec.rb index 4f9ca2df8..fdecb676e 100644 --- a/Library/Homebrew/test/rubocops/patches_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/patches_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do context "When auditing legacy patches" do it "When there is no legacy patch" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url 'http://example.com/foo-1.0.tgz' end @@ -18,7 +18,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do end it "Formula with `def patches`" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula homepage "ftp://example.com/foo" url "http://example.com/foo-1.0.tgz" @@ -51,7 +51,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do "https://github.com/dlang/dub/pull/1221.patch", ] patch_urls.each do |patch_url| - source = <<-EOS.undent + source = <<~EOS class Foo < Formula homepage "ftp://example.com/foo" url "http://example.com/foo-1.0.tgz" @@ -63,56 +63,56 @@ describe RuboCop::Cop::FormulaAudit::Patches do inspect_source(source) expected_offense = if patch_url =~ %r{/raw\.github\.com/} - [{ message: <<-EOS.undent.chomp, - GitHub/Gist patches should specify a revision: - #{patch_url} + [{ message: <<~EOS.chomp, + GitHub/Gist patches should specify a revision: + #{patch_url} EOS severity: :convention, line: 5, column: 12, source: source }] elsif patch_url =~ %r{macports/trunk} - [{ message: <<-EOS.undent.chomp, - MacPorts patches should specify a revision instead of trunk: - #{patch_url} + [{ message: <<~EOS.chomp, + MacPorts patches should specify a revision instead of trunk: + #{patch_url} EOS severity: :convention, line: 5, column: 33, source: source }] elsif patch_url =~ %r{^http://trac\.macports\.org} - [{ message: <<-EOS.undent.chomp, - Patches from MacPorts Trac should be https://, not http: - #{patch_url} + [{ message: <<~EOS.chomp, + Patches from MacPorts Trac should be https://, not http: + #{patch_url} EOS severity: :convention, line: 5, column: 5, source: source }] elsif patch_url =~ %r{^http://bugs\.debian\.org} - [{ message: <<-EOS.undent.chomp, - Patches from Debian should be https://, not http: - #{patch_url} + [{ message: <<~EOS.chomp, + Patches from Debian should be https://, not http: + #{patch_url} EOS severity: :convention, line: 5, column: 5, source: source }] elsif patch_url =~ %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} - [{ message: <<-EOS.undent, - use GitHub pull request URLs: - https://github.com/foo/foo-bar/pull/100.patch - Rather than patch-diff: - https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch + [{ message: <<~EOS, + use GitHub pull request URLs: + https://github.com/foo/foo-bar/pull/100.patch + Rather than patch-diff: + https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch EOS severity: :convention, line: 5, column: 5, source: source }] elsif patch_url =~ %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)} - [{ message: <<-EOS.undent, - GitHub patches should use the full_index parameter: - #{patch_url}?full_index=1 + [{ message: <<~EOS, + GitHub patches should use the full_index parameter: + #{patch_url}?full_index=1 EOS severity: :convention, line: 5, @@ -126,7 +126,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do end it "Formula with nested `def patches`" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula homepage "ftp://example.com/foo" url "http://example.com/foo-1.0.tgz" @@ -145,9 +145,9 @@ describe RuboCop::Cop::FormulaAudit::Patches do line: 4, column: 2, source: source }, - { message: <<-EOS.undent.chomp, - Patches from MacPorts Trac should be https://, not http: - http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/ + { message: <<~EOS.chomp, + Patches from MacPorts Trac should be https://, not http: + http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/ EOS severity: :convention, line: 8, @@ -172,7 +172,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do "https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch", ] patch_urls.each do |patch_url| - source = <<-EOS.undent + source = <<~EOS class Foo < Formula homepage "ftp://example.com/foo" url "http://example.com/foo-1.0.tgz" @@ -185,47 +185,47 @@ describe RuboCop::Cop::FormulaAudit::Patches do inspect_source(source) expected_offense = if patch_url =~ %r{/raw\.github\.com/} - [{ message: <<-EOS.undent.chomp, - GitHub/Gist patches should specify a revision: - #{patch_url} + [{ message: <<~EOS.chomp, + GitHub/Gist patches should specify a revision: + #{patch_url} EOS severity: :convention, line: 5, column: 16, source: source }] elsif patch_url =~ %r{macports/trunk} - [{ message: <<-EOS.undent.chomp, - MacPorts patches should specify a revision instead of trunk: - #{patch_url} + [{ message: <<~EOS.chomp, + MacPorts patches should specify a revision instead of trunk: + #{patch_url} EOS severity: :convention, line: 5, column: 37, source: source }] elsif patch_url =~ %r{^http://trac\.macports\.org} - [{ message: <<-EOS.undent.chomp, - Patches from MacPorts Trac should be https://, not http: - #{patch_url} + [{ message: <<~EOS.chomp, + Patches from MacPorts Trac should be https://, not http: + #{patch_url} EOS severity: :convention, line: 5, column: 9, source: source }] elsif patch_url =~ %r{^http://bugs\.debian\.org} - [{ message: <<-EOS.undent.chomp, - Patches from Debian should be https://, not http: - #{patch_url} + [{ message: <<~EOS.chomp, + Patches from Debian should be https://, not http: + #{patch_url} EOS severity: :convention, line: 5, column: 9, source: source }] elsif patch_url =~ %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} - [{ message: <<-EOS.undent, - use GitHub pull request URLs: - https://github.com/foo/foo-bar/pull/100.patch - Rather than patch-diff: - https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch + [{ message: <<~EOS, + use GitHub pull request URLs: + https://github.com/foo/foo-bar/pull/100.patch + Rather than patch-diff: + https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch EOS severity: :convention, line: 5, diff --git a/Library/Homebrew/test/rubocops/text_cop_spec.rb b/Library/Homebrew/test/rubocops/text_cop_spec.rb index 490801770..dbddff1ad 100644 --- a/Library/Homebrew/test/rubocops/text_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/text_cop_spec.rb @@ -8,7 +8,7 @@ describe RuboCop::Cop::FormulaAudit::Text do context "When auditing formula text" do it "with both openssl and libressl optional dependencies" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -32,7 +32,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "with both openssl and libressl dependencies" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -56,7 +56,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When xcodebuild is called without SYMROOT" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -81,7 +81,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When xcodebuild is called without any args" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -106,7 +106,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When go get is executed" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -131,7 +131,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When xcodebuild is executed" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -156,7 +156,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When scons is executed" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -180,8 +180,8 @@ describe RuboCop::Cop::FormulaAudit::Text do end end - it "When plist_options are not defined when using a formula-defined plist" do - source = <<-EOS.undent + it "When plist_options are not defined when using a formula-defined plist", :ruby23 do + source = <<~RUBY class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -190,19 +190,20 @@ describe RuboCop::Cop::FormulaAudit::Text do system "xcodebuild", "foo", "bar" end - def plist; <<-EOS.undent - <?xml version="1.0" encoding="UTF-8"?> - <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> - <plist version="1.0"> - <dict> - <key>Label</key> - <string>org.nrpe.agent</string> - </dict> - </plist> - \EOS + def plist + <<~XML + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + <key>Label</key> + <string>org.nrpe.agent</string> + </dict> + </plist> + XML end end - EOS + RUBY expected_offenses = [{ message: "Please set plist_options when using a formula-defined plist.", severity: :convention, @@ -218,7 +219,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When language/go is require'd" do - source = <<-EOS.undent + source = <<~EOS require "language/go" class Foo < Formula @@ -245,7 +246,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When formula uses virtualenv and also `setuptools` resource" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" @@ -275,7 +276,7 @@ describe RuboCop::Cop::FormulaAudit::Text do end it "When Formula.factory(name) is used" do - source = <<-EOS.undent + source = <<~EOS class Foo < Formula url "http://example.com/foo-1.0.tgz" homepage "http://example.com" diff --git a/Library/Homebrew/test/rubocops/urls_cop_spec.rb b/Library/Homebrew/test/rubocops/urls_cop_spec.rb index ad939a1a2..0bda7f110 100644 --- a/Library/Homebrew/test/rubocops/urls_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/urls_cop_spec.rb @@ -54,7 +54,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "http://prdownloads.sourceforge.net/foo/foo-1.tar.gz", - "msg" => <<-EOS.undent.chomp, + "msg" => <<~EOS.chomp, Don't use prdownloads in SourceForge urls (url is http://prdownloads.sourceforge.net/foo/foo-1.tar.gz). See: http://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/ EOS @@ -69,7 +69,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "http://http.debian.net/debian/dists/foo/", - "msg" => <<-EOS.undent, + "msg" => <<~EOS, Please use a secure mirror for Debian URLs. We recommend: https://mirrors.ocf.berkeley.edu/debian/dists/foo/ @@ -101,7 +101,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }, { "url" => "https://codeload.github.com/foo/bar/tar.gz/v0.1.1", - "msg" => <<-EOS.undent, + "msg" => <<~EOS, Use GitHub archive URLs: https://github.com/foo/bar/archive/v0.1.1.tar.gz Rather than codeload: @@ -114,7 +114,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 2, }] formulas.each do |formula| - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url "#{formula["url"]}" @@ -141,7 +141,7 @@ describe RuboCop::Cop::FormulaAudit::Urls do "col" => 4, }] formulas.each do |formula| - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url "https://foo.com" @@ -169,12 +169,12 @@ describe RuboCop::Cop::FormulaAudit::Urls do end it "with duplicate mirror" do - source = <<-EOS.undent - class Foo < Formula - desc "foo" - url "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" - mirror "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" - end + source = <<~EOS + class Foo < Formula + desc "foo" + url "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" + mirror "https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz" + end EOS expected_offenses = [{ message: "URL should not be duplicated as a mirror: https://ftpmirror.fnu.org/foo/foo-1.0.tar.gz", @@ -204,13 +204,13 @@ describe RuboCop::Cop::FormulaAuditStrict::PyPiUrls do "corrected_url" =>"https://files.pythonhosted.org/packages/source/foo/foo-0.1.tar.gz", }] formulas.each do |formula| - source = <<-EOS.undent + source = <<~EOS class Foo < Formula desc "foo" url "#{formula["url"]}" end EOS - corrected_source = <<-EOS.undent + corrected_source = <<~EOS class Foo < Formula desc "foo" url "#{formula["corrected_url"]}" |
