New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use “squiggly” heredocs. #3319

Merged
merged 2 commits into from Oct 20, 2017

Conversation

Projects
None yet
4 participants
@reitermarkus
Member

reitermarkus commented Oct 15, 2017

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew tests with your changes locally?
@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Oct 15, 2017

Contributor

This feels like we're replacing something self-explanatory with an emoji.

Contributor

ilovezfs commented Oct 15, 2017

This feels like we're replacing something self-explanatory with an emoji.

@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Oct 18, 2017

Member

There's some CI failures but I'm broadly 👍 to this. I'm not in love with the syntax but it's standard Ruby at this point so we may as well use it rather than our own custom stuff.

Also, please create a Homebrew/homebrew-core PR for the corresponding change there before this gets merged.

Member

MikeMcQuaid commented Oct 18, 2017

There's some CI failures but I'm broadly 👍 to this. I'm not in love with the syntax but it's standard Ruby at this point so we may as well use it rather than our own custom stuff.

Also, please create a Homebrew/homebrew-core PR for the corresponding change there before this gets merged.

@ilovezfs ilovezfs referenced this pull request Oct 18, 2017

Merged

Use “squiggly” heredocs. #19600

2 of 4 tasks complete
@commitay

This comment has been minimized.

Show comment
Hide comment
@commitay

commitay Oct 18, 2017

Member

@reitermarkus Do casks need to be changed to "squiggy"?

Member

commitay commented Oct 18, 2017

@reitermarkus Do casks need to be changed to "squiggy"?

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 19, 2017

Member

@commitay, yes, ideally.

Member

reitermarkus commented Oct 19, 2017

@commitay, yes, ideally.

@MikeMcQuaid MikeMcQuaid merged commit 76cd7c7 into Homebrew:master Oct 20, 2017

2 of 3 checks passed

codecov/patch 34.01% of diff hit (target 67.91%)
Details
codecov/project 67.93% (+0.01%) compared to 270b752
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid
Member

MikeMcQuaid commented Oct 20, 2017

Thanks @reitermarkus!

@reitermarkus reitermarkus deleted the reitermarkus:squiggly-heredocs branch Oct 20, 2017

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Oct 20, 2017

Contributor

@reitermarkus hmm I'm having trouble getting anything to trigger a you-must-use-squiggly-heredocs error from brew style or brew audit --strict.

iMac-TMP:Homebrew joe$ brew config
HOMEBREW_VERSION: 1.3.6-26-g6fe7c5f-dirty
ORIGIN: https://github.com/Homebrew/brew
HEAD: 6fe7c5fc9576b1368a17c1c7f426d4511ac736cd
Last commit: 26 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 792c96ee94ec44cd6c8e832193978924f53d7592
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 8.0 build 800
Git: 2.10.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.4.2/bin/ruby
Java: 9.0.1, 1.8.0_151, 1.7.0_154-zulu-7.20.0.3
macOS: 10.11.6-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11
iMac-TMP:Homebrew joe$ git diff
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 5afb19e..effcab7 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -29,12 +29,12 @@ module Homebrew
       keg_only = keg_only?(keg.rack)
       if HOMEBREW_PREFIX.to_s == "/usr/local" && keg_only &&
          keg.name.start_with?("openssl", "libressl")
-        opoo <<~EOS
-          Refusing to link: #{keg.name}
-          Linking keg-only #{keg.name} means you may end up linking against the insecure,
-          deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
-          Instead, pass the full include/library paths to your compiler e.g.:
-            -I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
+        opoo <<-EOS
+        Refusing to link: #{keg.name}
+        Linking keg-only #{keg.name} means you may end up linking against the insecure,
+        deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
+        Instead, pass the full include/library paths to your compiler e.g.:
+          -I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
         EOS
         next
       elsif keg.linked?
iMac-TMP:Homebrew joe$ brew style
Inspecting 661 files
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

661 files inspected, no offenses detected
iMac-TMP:Homebrew joe$ 

Ditto with formulae.

Contributor

ilovezfs commented Oct 20, 2017

@reitermarkus hmm I'm having trouble getting anything to trigger a you-must-use-squiggly-heredocs error from brew style or brew audit --strict.

iMac-TMP:Homebrew joe$ brew config
HOMEBREW_VERSION: 1.3.6-26-g6fe7c5f-dirty
ORIGIN: https://github.com/Homebrew/brew
HEAD: 6fe7c5fc9576b1368a17c1c7f426d4511ac736cd
Last commit: 26 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 792c96ee94ec44cd6c8e832193978924f53d7592
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 8.0 build 800
Git: 2.10.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.4.2/bin/ruby
Java: 9.0.1, 1.8.0_151, 1.7.0_154-zulu-7.20.0.3
macOS: 10.11.6-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11
iMac-TMP:Homebrew joe$ git diff
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 5afb19e..effcab7 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -29,12 +29,12 @@ module Homebrew
       keg_only = keg_only?(keg.rack)
       if HOMEBREW_PREFIX.to_s == "/usr/local" && keg_only &&
          keg.name.start_with?("openssl", "libressl")
-        opoo <<~EOS
-          Refusing to link: #{keg.name}
-          Linking keg-only #{keg.name} means you may end up linking against the insecure,
-          deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
-          Instead, pass the full include/library paths to your compiler e.g.:
-            -I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
+        opoo <<-EOS
+        Refusing to link: #{keg.name}
+        Linking keg-only #{keg.name} means you may end up linking against the insecure,
+        deprecated system OpenSSL while using the headers from Homebrew's #{keg.name}.
+        Instead, pass the full include/library paths to your compiler e.g.:
+          -I#{HOMEBREW_PREFIX}/opt/#{keg.name}/include -L#{HOMEBREW_PREFIX}/opt/#{keg.name}/lib
         EOS
         next
       elsif keg.linked?
iMac-TMP:Homebrew joe$ brew style
Inspecting 661 files
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

661 files inspected, no offenses detected
iMac-TMP:Homebrew joe$ 

Ditto with formulae.

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 20, 2017

Member

It won't trigger because <<-EOS is not the same as <<~EOS. I think it will trigger on <<-EOS.unindent or <<-EOS.strip_indent, both of which we weren't using before.

Member

reitermarkus commented Oct 20, 2017

It won't trigger because <<-EOS is not the same as <<~EOS. I think it will trigger on <<-EOS.unindent or <<-EOS.strip_indent, both of which we weren't using before.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Oct 20, 2017

Contributor

Neither of those triggers it either.

Contributor

ilovezfs commented Oct 20, 2017

Neither of those triggers it either.

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 20, 2017

Member

Weird.

Member

reitermarkus commented Oct 20, 2017

Weird.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs
Contributor

ilovezfs commented Oct 20, 2017

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 20, 2017

Member

I think it only triggers on

<<-EOS
not indented
EOS
Member

reitermarkus commented Oct 20, 2017

I think it only triggers on

<<-EOS
not indented
EOS
@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Oct 20, 2017

Contributor

@reitermarkus see the opoo above which is exactly that. #3319 (comment)

Contributor

ilovezfs commented Oct 20, 2017

@reitermarkus see the opoo above which is exactly that. #3319 (comment)

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 20, 2017

Member

Above it is indented 8 spaces.

Member

reitermarkus commented Oct 20, 2017

Above it is indented 8 spaces.

@commitay commitay referenced this pull request Oct 21, 2017

Merged

squiggly heredocs #39869

ochaochaocha3 added a commit to ochaochaocha3/homebrew-mroonga that referenced this pull request Apr 30, 2018

Use <<~EOS instead of <<-EOS.undent
Homebrew doesn't use String#undent since Homebrew/brew#3319.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.