aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/.rubocop.yml17
-rw-r--r--Library/Homebrew/.rubocop.yml87
-rw-r--r--Library/Homebrew/cmd/missing.rb2
-rw-r--r--Library/Homebrew/cmd/style.rb2
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb7
-rw-r--r--Library/Homebrew/extend/ENV/super.rb2
-rw-r--r--Library/Homebrew/locale.rb8
-rw-r--r--Library/Homebrew/tap.rb2
-rw-r--r--Library/Homebrew/utils/formatter.rb4
9 files changed, 33 insertions, 98 deletions
diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml
index 2fe239447..d749adc35 100644
--- a/Library/.rubocop.yml
+++ b/Library/.rubocop.yml
@@ -48,6 +48,12 @@ Style/AlignHash:
Style/AlignParameters:
Enabled: false
+Style/BarePercentLiterals:
+ EnforcedStyle: percent_q
+
+Style/BlockDelimiters:
+ EnforcedStyle: line_count_based
+
Style/CaseIndentation:
IndentWhenRelativeTo: end
@@ -76,9 +82,11 @@ Style/FileName:
Style/GuardClause:
Enabled: false
+# depends_on a: :b looks weird in formulae.
Style/HashSyntax:
EnforcedStyle: hash_rockets
+# disabled until it respects line length
Style/IfUnlessModifier:
Enabled: false
@@ -133,8 +141,6 @@ Style/StringLiterals:
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
-# TODO: enforce when rubocop has shipped this
-# https://github.com/bbatsov/rubocop/pull/3513
Style/TernaryParentheses:
Enabled: false
@@ -142,15 +148,8 @@ Style/TernaryParentheses:
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
-Style/UnneededCapitalW:
- Enabled: false
-
-# TODO: enforce when rubocop has fixed this
-# https://github.com/bbatsov/rubocop/issues/3516
Style/VariableNumber:
Enabled: false
-# TODO: enforce when rubocop has fixed this
-# https://github.com/bbatsov/rubocop/issues/1543
Style/WordArray:
Enabled: false
diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml
index f4f80800a..325674398 100644
--- a/Library/Homebrew/.rubocop.yml
+++ b/Library/Homebrew/.rubocop.yml
@@ -9,11 +9,19 @@ AllCops:
- 'cask/**/*'
- '**/vendor/**/*'
+# so many of these in formulae but none in here
+Lint/AmbiguousRegexpLiteral:
+ Enabled: true
+
# `formula do` uses nested method definitions
Lint/NestedMethodDefinition:
Exclude:
- 'test/**/*'
+# so many of these in formulae but none in here
+Lint/ParenthesesAsGroupedExpression:
+ Enabled: false
+
Metrics/ModuleLength:
CountComments: false
Exclude:
@@ -21,81 +29,11 @@ Metrics/ModuleLength:
- 'cask/lib/hbc/macos.rb'
- 'cask/lib/hbc/utils.rb'
-Style/BarePercentLiterals:
- EnforcedStyle: percent_q
-
-Style/BlockDelimiters:
- EnforcedStyle: semantic
- FunctionalMethods:
- - expect
- - find
- - let
- - let!
- - subject
- - watch
- - inject
- - map
- - map!
- - collect
- - collect!
- - reject
- - reject!
- - delete_if
- - with_object
- - popen_read
- ProceduralMethods:
- - after
- - at_exit
- - before
- - benchmark
- - bm
- - bmbm
- - capture_io
- - capture_output
- - capture_subprocess_io
- - chdir
- - context
- - create
- - define_method
- - define_singleton_method
- - fork
- - measure
- - new
- - open
- - realtime
- - shutup
- - tap
- - each
- - each_pair
- - each_with_index
- - reverse_each
- - ignore_interrupts
- IgnoredMethods:
- - each_with_object
- - it
- - its
- - lambda
- - proc
- - formula
- - mock
- - devel
- - stable
- - head
- - assert_raises
- - assert_nothing_raised
- - resource
- - with_build_environment
- - ensure_writable
- - satisfy
- - fetch
- - brew
- - expand
- - env
- - recursive_dependencies
- - trap
- - link_dir
- - with_system_path
+# so many of these in formulae but none in here
+Style/GuardClause:
+ Enabled: true
+# hash-rockets preferred for formulae, a: 1 preferred elsewhere
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
@@ -109,4 +47,3 @@ Style/PredicateName:
Exclude:
- 'compat/**/*'
NameWhitelist: is_32_bit?, is_64_bit?
-
diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb
index 525461108..148fe5bef 100644
--- a/Library/Homebrew/cmd/missing.rb
+++ b/Library/Homebrew/cmd/missing.rb
@@ -20,7 +20,7 @@ module Homebrew
Diagnostic.missing_deps(ff) do |name, missing|
print "#{name}: " if ff.size > 1
- puts (missing * " ").to_s
+ puts missing.join(" ")
end
end
end
diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb
index 9538b890a..08eb111a5 100644
--- a/Library/Homebrew/cmd/style.rb
+++ b/Library/Homebrew/cmd/style.rb
@@ -49,7 +49,7 @@ module Homebrew
fix = options[:fix]
Homebrew.install_gem_setup_path! "rubocop", "0.43.0"
- args = %W[
+ args = %w[
--force-exclusion
]
args << "--auto-correct" if fix
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 9a15c6de7..12eaf9167 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -137,7 +137,7 @@ class FormulaAuditor
attr_reader :formula, :text, :problems
- BUILD_TIME_DEPS = %W[
+ BUILD_TIME_DEPS = %w[
autoconf
automake
boost-build
@@ -449,9 +449,8 @@ class FormulaAuditor
end
return unless @new_formula
- unless formula.deprecated_options.empty?
- problem "New formulae should not use `deprecated_option`."
- end
+ return if formula.deprecated_options.empty?
+ problem "New formulae should not use `deprecated_option`."
end
def audit_desc
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index a3837c695..a75cba406 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -139,7 +139,7 @@ module Superenv
end
def determine_pkg_config_libdir
- paths = %W[/usr/lib/pkgconfig]
+ paths = %w[/usr/lib/pkgconfig]
paths += homebrew_extra_pkg_config_paths
paths.to_path_s
end
diff --git a/Library/Homebrew/locale.rb b/Library/Homebrew/locale.rb
index e749a5004..5e778f3b4 100644
--- a/Library/Homebrew/locale.rb
+++ b/Library/Homebrew/locale.rb
@@ -51,20 +51,20 @@ class Locale
def include?(other)
other = self.class.parse(other) unless other.is_a?(self.class)
- [:language, :region, :script].all? { |var|
+ [:language, :region, :script].all? do |var|
if other.public_send(var).nil?
true
else
public_send(var) == other.public_send(var)
end
- }
+ end
end
def eql?(other)
other = self.class.parse(other) unless other.is_a?(self.class)
- [:language, :region, :script].all? { |var|
+ [:language, :region, :script].all? do |var|
public_send(var) == other.public_send(var)
- }
+ end
rescue ParserError
false
end
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index d970a0a37..3659abe4f 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -206,7 +206,7 @@ class Tap
end
ohai "Unshallowing #{name}" unless quiet
- args = %W[fetch --unshallow]
+ args = %w[fetch --unshallow]
args << "-q" if quiet
path.cd { safe_system "git", *args }
return
diff --git a/Library/Homebrew/utils/formatter.rb b/Library/Homebrew/utils/formatter.rb
index 4685e8c5d..8a9afb9af 100644
--- a/Library/Homebrew/utils/formatter.rb
+++ b/Library/Homebrew/utils/formatter.rb
@@ -78,9 +78,9 @@ module Formatter
rows.times do |row_index|
item_indices_for_row = row_index.step(objects.size - 1, rows).to_a
- first_n = item_indices_for_row[0...-1].map { |index|
+ first_n = item_indices_for_row[0...-1].map do |index|
objects[index] + "".rjust(col_width - object_lengths[index])
- }
+ end
# don't add trailing whitespace to last column
last = objects.values_at(item_indices_for_row.last)