Skip to content

Commit

Permalink
Merge pull request #14452 from dduugg/rm-undent-mp
Browse files Browse the repository at this point in the history
remove String#undent 🐵-patch
  • Loading branch information
apainintheneck committed Jan 31, 2023
2 parents 79676ad + 220becd commit 1e4ae4e
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 113 deletions.
12 changes: 0 additions & 12 deletions Library/Homebrew/rubocops/cask/extend/string.rb

This file was deleted.

1 change: 0 additions & 1 deletion Library/Homebrew/rubocops/rubocop-cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
require_relative "cask/ast/stanza"
require_relative "cask/ast/cask_header"
require_relative "cask/ast/cask_block"
require_relative "cask/extend/string"
require_relative "cask/extend/node"
require_relative "cask/mixin/cask_help"
require_relative "cask/mixin/on_homepage_stanza"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

context "when the homepage URL ends with a slash" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
Expand All @@ -23,7 +23,7 @@

context "when the homepage URL does not end with a slash but has a path" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/path'
end
Expand All @@ -35,14 +35,14 @@

context "when the homepage URL does not end with a slash and has no path" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh'
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
Expand Down
44 changes: 22 additions & 22 deletions Library/Homebrew/test/rubocops/cask/on_system_conditionals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
context "when auditing `postflight` stanzas" do
context "when there are no on_system blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
foobar
Expand All @@ -26,7 +26,7 @@

context "when there is an `on_intel` block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
on_intel do
Expand All @@ -37,7 +37,7 @@
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
if Hardware::CPU.intel?
Expand All @@ -64,7 +64,7 @@

context "when there is an `on_monterey` block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
on_monterey do
Expand All @@ -75,7 +75,7 @@
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
if MacOS.version == :monterey
Expand All @@ -102,7 +102,7 @@

context "when there is an `on_monterey :or_older` block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
on_monterey :or_older do
Expand All @@ -113,7 +113,7 @@
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
if MacOS.version <= :monterey
Expand Down Expand Up @@ -143,7 +143,7 @@
context "when auditing `sha256` stanzas inside on_arch blocks" do
context "when there are no on_arch blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
end
Expand All @@ -155,7 +155,7 @@

context "when the proper `sha256` stanza is used" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
sha256 arm: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94",
intel: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
Expand All @@ -168,7 +168,7 @@

context "when the `sha256` stanza needs to be removed from the on_arch blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
Expand All @@ -180,15 +180,15 @@
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
#{" "}
sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
end
CASK
end
let(:offense_source) do
<<-CASK.undent
<<~CASK
on_arm do
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
end
Expand All @@ -213,7 +213,7 @@

context "when there is only one on_arch block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
Expand All @@ -227,7 +227,7 @@

context "when there is also a `version` stanza inside the on_arch blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
version "1.0.0"
Expand All @@ -246,7 +246,7 @@

context "when there is also a `version` stanza inside only a single on_arch block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
version "2.0.0"
Expand All @@ -266,7 +266,7 @@
context "when auditing loose `Hardware::CPU` method calls" do
context "when there is a `Hardware::CPU.arm?` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if Hardware::CPU.arm? && other_condition
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
Expand All @@ -291,7 +291,7 @@

context "when there is a `Hardware::CPU.intel?` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if Hardware::CPU.intel? && other_condition
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
Expand All @@ -316,7 +316,7 @@

context "when there is a `Hardware::CPU.arch` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
Expand All @@ -342,7 +342,7 @@
context "when auditing loose `MacOS.version` method calls" do
context "when there is a `MacOS.version ==` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if MacOS.version == :catalina
version "1.0.0"
Expand All @@ -367,7 +367,7 @@

context "when there is a `MacOS.version <=` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if MacOS.version <= :catalina
version "1.0.0"
Expand All @@ -392,7 +392,7 @@

context "when there is a `MacOS.version >=` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if MacOS.version >= :catalina
version "1.0.0"
Expand All @@ -417,7 +417,7 @@

context "when there is a `MacOS.version` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
Expand Down

0 comments on commit 1e4ae4e

Please sign in to comment.