aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops
diff options
context:
space:
mode:
authorGautham Goli2017-10-21 13:26:25 +0530
committerGautham Goli2017-10-21 13:53:44 +0530
commit7b2fab8ec5d8e93878d56d31879e8a05e4ab59bc (patch)
tree43b6425f24829fadc8d1ea4bf938d6228cc6ef3b /Library/Homebrew/rubocops
parentee35d6586791be65b9cfbb976394c9191625aaee (diff)
parenta08f1c674803824e291c326adc2aca80068020e6 (diff)
downloadbrew-7b2fab8ec5d8e93878d56d31879e8a05e4ab59bc.tar.bz2
Merge branch 'master' into audit_line_rubocop_part_4_rebase_attempt_1
Diffstat (limited to 'Library/Homebrew/rubocops')
-rw-r--r--Library/Homebrew/rubocops/conflicts_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb8
-rw-r--r--Library/Homebrew/rubocops/formula_desc_cop.rb2
-rw-r--r--Library/Homebrew/rubocops/lines_cop.rb14
-rw-r--r--Library/Homebrew/rubocops/patches_cop.rb12
-rw-r--r--Library/Homebrew/rubocops/urls_cop.rb6
6 files changed, 22 insertions, 22 deletions
diff --git a/Library/Homebrew/rubocops/conflicts_cop.rb b/Library/Homebrew/rubocops/conflicts_cop.rb
index 6f05d0567..1cca3f8ae 100644
--- a/Library/Homebrew/rubocops/conflicts_cop.rb
+++ b/Library/Homebrew/rubocops/conflicts_cop.rb
@@ -6,7 +6,7 @@ module RuboCop
module FormulaAudit
# This cop audits versioned Formulae for `conflicts_with`
class Conflicts < FormulaCop
- MSG = <<-EOS.undent
+ MSG = <<~EOS.freeze
Versioned formulae should not use `conflicts_with`.
Use `keg_only :versioned_formula` instead.
EOS
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 63c75194c..7da4d0f10 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -185,19 +185,19 @@ module RuboCop
nil
end
- def_node_search :required_dependency?, <<-EOS.undent
+ def_node_search :required_dependency?, <<~EOS
(send nil :depends_on ({str sym} _))
EOS
- def_node_search :required_dependency_name?, <<-EOS.undent
+ def_node_search :required_dependency_name?, <<~EOS
(send nil :depends_on ({str sym} %1))
EOS
- def_node_search :dependency_type_hash_match?, <<-EOS.undent
+ def_node_search :dependency_type_hash_match?, <<~EOS
(hash (pair ({str sym} _) ({str sym} %1)))
EOS
- def_node_search :dependency_name_hash_match?, <<-EOS.undent
+ def_node_search :dependency_name_hash_match?, <<~EOS
(hash (pair ({str sym} %1) ({str sym} _)))
EOS
diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb
index 2ef60303d..05f60c9d5 100644
--- a/Library/Homebrew/rubocops/formula_desc_cop.rb
+++ b/Library/Homebrew/rubocops/formula_desc_cop.rb
@@ -29,7 +29,7 @@ module RuboCop
desc_length = "#{@formula_name}: #{string_content(desc)}".length
max_desc_length = 80
return if desc_length <= max_desc_length
- problem <<-EOS.undent
+ problem <<~EOS
Description is too long. "name: desc" should be less than #{max_desc_length} characters.
Length is calculated as #{@formula_name} + desc. (currently #{desc_length})
EOS
diff --git a/Library/Homebrew/rubocops/lines_cop.rb b/Library/Homebrew/rubocops/lines_cop.rb
index 7e434d755..9354f41f6 100644
--- a/Library/Homebrew/rubocops/lines_cop.rb
+++ b/Library/Homebrew/rubocops/lines_cop.rb
@@ -1,4 +1,3 @@
-require "FileUtils"
require_relative "./extend/formula_cop"
module RuboCop
@@ -297,7 +296,7 @@ module RuboCop
end
find_method_with_args(body_node, :skip_clean, :all) do
- problem <<-EOS.undent.chomp
+ problem <<~EOS.chomp
`skip_clean :all` is deprecated; brew no longer strips symbols
Pass explicit paths to prevent Homebrew from removing empty folders.
EOS
@@ -313,6 +312,7 @@ module RuboCop
end
find_instance_method_call(body_node, "ENV", :universal_binary) do
+ next if @formula_name == "wine"
problem "macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated."
end
@@ -352,7 +352,7 @@ module RuboCop
node.modifier_form?
end
- def_node_search :conditional_dependencies, <<-EOS.undent
+ def_node_search :conditional_dependencies, <<~EOS
{$(if (send (send nil :build) ${:include? :with? :without?} $(str _))
(send nil :depends_on $({str sym} _)) nil)
@@ -361,22 +361,22 @@ module RuboCop
EOS
# Match depends_on with hash as argument
- def_node_matcher :hash_dep, <<-EOS.undent
+ def_node_matcher :hash_dep, <<~EOS
{(hash (pair $(str _) $(str _)))
(hash (pair $(str _) (array $(str _) ...)))}
EOS
- def_node_matcher :destructure_hash, <<-EOS.undent
+ def_node_matcher :destructure_hash, <<~EOS
(hash (pair $(str _) $(sym _)))
EOS
- def_node_search :formula_path_strings, <<-EOS.undent
+ def_node_search :formula_path_strings, <<~EOS
{(dstr (begin (send nil %1)) $(str _ ))
(dstr _ (begin (send nil %1)) $(str _ ))}
EOS
# Node Pattern search for Language::Node
- def_node_search :languageNodeModule?, <<-EOS.undent
+ def_node_search :languageNodeModule?, <<~EOS
(const (const nil :Language) :Node)
EOS
end
diff --git a/Library/Homebrew/rubocops/patches_cop.rb b/Library/Homebrew/rubocops/patches_cop.rb
index 7ee1a127a..a752f1019 100644
--- a/Library/Homebrew/rubocops/patches_cop.rb
+++ b/Library/Homebrew/rubocops/patches_cop.rb
@@ -28,7 +28,7 @@ module RuboCop
gh_patch_param_pattern = %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)}
if regex_match_group(patch, gh_patch_param_pattern)
if patch_url !~ /\?full_index=\w+$/
- problem <<-EOS.undent
+ problem <<~EOS
GitHub patches should use the full_index parameter:
#{patch_url}?full_index=1
EOS
@@ -41,7 +41,7 @@ module RuboCop
%r{gist\.githubusercontent\.com/.+/raw}])
if regex_match_group(patch, gh_patch_patterns)
if patch_url !~ /[a-fA-F0-9]{40}/
- problem <<-EOS.undent.chomp
+ problem <<~EOS.chomp
GitHub/Gist patches should specify a revision:
#{patch_url}
EOS
@@ -50,7 +50,7 @@ module RuboCop
gh_patch_diff_pattern = %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}
if match_obj = regex_match_group(patch, gh_patch_diff_pattern)
- problem <<-EOS.undent
+ problem <<~EOS
use GitHub pull request URLs:
https://github.com/#{match_obj[1]}/#{match_obj[2]}/pull/#{match_obj[3]}.patch
Rather than patch-diff:
@@ -59,21 +59,21 @@ module RuboCop
end
if regex_match_group(patch, %r{macports/trunk})
- problem <<-EOS.undent.chomp
+ problem <<~EOS.chomp
MacPorts patches should specify a revision instead of trunk:
#{patch_url}
EOS
end
if regex_match_group(patch, %r{^http://trac\.macports\.org})
- problem <<-EOS.undent.chomp
+ problem <<~EOS.chomp
Patches from MacPorts Trac should be https://, not http:
#{patch_url}
EOS
end
return unless regex_match_group(patch, %r{^http://bugs\.debian\.org})
- problem <<-EOS.undent.chomp
+ problem <<~EOS.chomp
Patches from Debian should be https://, not http:
#{patch_url}
EOS
diff --git a/Library/Homebrew/rubocops/urls_cop.rb b/Library/Homebrew/rubocops/urls_cop.rb
index 071a4c42d..414f633c9 100644
--- a/Library/Homebrew/rubocops/urls_cop.rb
+++ b/Library/Homebrew/rubocops/urls_cop.rb
@@ -104,7 +104,7 @@ module RuboCop
end
if url =~ %r{^https?://prdownloads\.}
- problem <<-EOS.undent.chomp
+ problem <<~EOS.chomp
Don't use prdownloads in SourceForge urls (url is #{url}).
See: http://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/
EOS
@@ -121,7 +121,7 @@ module RuboCop
# one out of the grab bag.
unsecure_deb_pattern = %r{^http://http\.debian\.net/debian/(.*)}i
audit_urls(urls, unsecure_deb_pattern) do |match, _|
- problem <<-EOS.undent
+ problem <<~EOS
Please use a secure mirror for Debian URLs.
We recommend:
https://mirrors.ocf.berkeley.edu/debian/#{match[1]}
@@ -176,7 +176,7 @@ module RuboCop
# Don't use GitHub codeload URLs
codeload_gh_pattern = %r{https?://codeload\.github\.com/(.+)/(.+)/(?:tar\.gz|zip)/(.+)}
audit_urls(urls, codeload_gh_pattern) do |match, url|
- problem <<-EOS.undent
+ problem <<~EOS
Use GitHub archive URLs:
https://github.com/#{match[1]}/#{match[2]}/archive/#{match[3]}.tar.gz
Rather than codeload: