aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-09-27 12:49:34 +0100
committerGitHub2016-09-27 12:49:34 +0100
commit4488eddf910e3a9e5f7fdbf55055375be13f0ae5 (patch)
tree3c413475a7d6b7e144ae7e97d8dc360d0b108629 /Library
parent0ffc9de47820a03c7207c4a0a61fbb39c14927d6 (diff)
parentb114db13d57e511ac73bddc907bfa4f8b4845635 (diff)
downloadbrew-4488eddf910e3a9e5f7fdbf55055375be13f0ae5.tar.bz2
Merge pull request #1128 from reitermarkus/rubocop
RuboCop changes.
Diffstat (limited to 'Library')
-rw-r--r--Library/.rubocop_rules.yml298
-rw-r--r--Library/.rubocop_todo.yml129
-rwxr-xr-xLibrary/Homebrew/.simplecov8
-rw-r--r--Library/Homebrew/cask/.rubocop.yml2
-rw-r--r--Library/Homebrew/cleanup.rb6
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb53
6 files changed, 322 insertions, 174 deletions
diff --git a/Library/.rubocop_rules.yml b/Library/.rubocop_rules.yml
index 543dc4018..638989291 100644
--- a/Library/.rubocop_rules.yml
+++ b/Library/.rubocop_rules.yml
@@ -1,75 +1,194 @@
-# ruby style guide favorite
-Style/StringLiterals:
- EnforcedStyle: double_quotes
-
-# consistency with above
-Style/StringLiteralsInInterpolation:
- EnforcedStyle: double_quotes
-
-# only for numbers >= 1_000_000
-Style/NumericLiterals:
- MinDigits: 7
-
-# zero-prefixed octal literals are just too widely used (and mostly understood)
-Style/NumericLiteralPrefix:
- EnforcedOctalStyle: zero_only
-
-# percent-x is allowed for multiline
-Style/CommandLiteral:
- EnforcedStyle: mixed
-
-# depends_on foo: :bar looks rubbish
-Style/HashSyntax:
- EnforcedStyle: ruby19
- Exclude:
- - 'Taps/**/*'
-
-# paths abound, easy escape
-Style/RegexpLiteral:
- EnforcedStyle: slashes
-
-Style/Alias:
- EnforcedStyle: prefer_alias
-
-# our current conditional style is established, clear and
-# requiring users to change that now would be confusing.
-Style/ConditionalAssignment:
- Enabled: false
-
-# no metrics for formulas
Metrics/AbcSize:
Enabled: false
-Metrics/CyclomaticComplexity:
- Enabled: false
-Metrics/MethodLength:
- Enabled: false
+
Metrics/ClassLength:
Enabled: false
-Metrics/PerceivedComplexity:
+
+Metrics/CyclomaticComplexity:
Enabled: false
-# we often need very long lines
Metrics/LineLength:
Enabled: false
-# formulas have no mandatory doc
-Style/Documentation:
+Metrics/MethodLength:
+ Enabled: false
+
+Metrics/ModuleLength:
+ CountComments: false
+ Exclude:
+ - 'Homebrew/cask/lib/hbc/locations.rb'
+ - 'Homebrew/cask/lib/hbc/macos.rb'
+ - 'Homebrew/cask/lib/hbc/utils.rb'
+
+Metrics/PerceivedComplexity:
Enabled: false
# favor parens-less DSL-style arguments
Lint/AmbiguousOperator:
Enabled: false
+
Lint/AmbiguousRegexpLiteral:
Enabled: false
+
Lint/AssignmentInCondition:
Enabled: false
+
+Lint/EndAlignment:
+ AlignWith: variable
+
+# `formula do` uses nested method definitions
+Lint/NestedMethodDefinition:
+ Exclude:
+ - 'Homebrew/test/**/*'
+
Lint/ParenthesesAsGroupedExpression:
Enabled: false
-# compact style
+Style/Alias:
+ EnforcedStyle: prefer_alias
+
+Style/AlignHash:
+ Enabled: false
+
+# `system` is a special case and aligns on second argument
+Style/AlignParameters:
+ Enabled: false
+
+Style/BarePercentLiterals:
+ Exclude:
+ - 'Taps/**/*'
+ EnforcedStyle: percent_q
+
+Style/BlockDelimiters:
+ EnforcedStyle: semantic
+ Exclude:
+ - 'Taps/**/*'
+ 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
+
+Style/CaseIndentation:
+ IndentWhenRelativeTo: end
+
+Style/ClassAndModuleChildren:
+ EnforcedStyle: nested
+
+# percent-x is allowed for multiline
+Style/CommandLiteral:
+ EnforcedStyle: mixed
+
+# our current conditional style is established, clear and
+# requiring users to change that now would be confusing.
+Style/ConditionalAssignment:
+ Enabled: false
+
+Style/Documentation:
+ Enabled: false
+
Style/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
+# dashes in filenames are typical
+Style/FileName:
+ Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
+
+# counterproductive in formulas, notably within the install method
+Style/GuardClause:
+ Exclude:
+ - 'Taps/**/*'
+
+# depends_on foo: :bar looks rubbish
+Style/HashSyntax:
+ EnforcedStyle: ruby19_no_mixed_keys
+ Exclude:
+ - 'Taps/**/*'
+
+Style/IfUnlessModifier:
+ Exclude:
+ - 'Taps/**/*'
+
+Style/IndentArray:
+ EnforcedStyle: special_inside_parentheses
+
+# we won't change backward compatible method names
+Style/MethodName:
+ Exclude:
+ - 'Homebrew/compat/**/*'
+
+# only for numbers >= 1_000_000
+Style/NumericLiterals:
+ MinDigits: 7
+
+# zero-prefixed octal literals are just too widely used (and mostly understood)
+Style/NumericLiteralPrefix:
+ EnforcedOctalStyle: zero_only
+
# consistency and readability when faced with string interpolation
Style/PercentLiteralDelimiters:
PreferredDelimiters:
@@ -83,6 +202,23 @@ Style/PercentLiteralDelimiters:
'%W': '[]'
'%x': '()'
+# we prefer Perl-style regex back references
+Style/PerlBackrefs:
+ Enabled: false
+
+# we won't change backward compatible predicate names
+Style/PredicateName:
+ Exclude:
+ - 'Homebrew/compat/**/*'
+ NameWhitelist: is_32_bit?, is_64_bit?
+
+Style/RaiseArgs:
+ EnforcedStyle: exploded
+
+# paths abound, easy escape
+Style/RegexpLiteral:
+ EnforcedStyle: slashes
+
# conflicts with DSL-style path concatenation with `/`
Style/SpaceAroundOperators:
Enabled: false
@@ -91,66 +227,32 @@ Style/SpaceAroundOperators:
Style/SpecialGlobalVars:
Enabled: false
-# `system` is a special case and aligns on second argument
-Style/AlignParameters:
- Enabled: false
-
-# counterproductive in formulas, notably within the install method
-Style/GuardClause:
- Exclude:
- - 'Taps/**/*'
-Style/IfUnlessModifier:
- Exclude:
- - 'Taps/**/*'
+# ruby style guide favorite
+Style/StringLiterals:
+ EnforcedStyle: double_quotes
-# TODO: enforce when rubocop has fixed this
-# https://github.com/bbatsov/rubocop/issues/3516
-Style/VariableNumber:
- Enabled: false
+# consistency with above
+Style/StringLiteralsInInterpolation:
+ EnforcedStyle: double_quotes
# TODO: enforce when rubocop has shipped this
# https://github.com/bbatsov/rubocop/pull/3513
Style/TernaryParentheses:
Enabled: false
-# dashes in filenames are typical
-Style/FileName:
- Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
-
-# no percent word array, being friendly to non-ruby users
-# TODO: enforce when rubocop has fixed this
-# https://github.com/bbatsov/rubocop/issues/1543
-Style/WordArray:
- Enabled: false
-Style/UnneededCapitalW:
- Enabled: false
-
-# we prefer compact if-else-end/case-when-end alignment
-Lint/EndAlignment:
- AlignWith: variable
-Style/CaseIndentation:
- IndentWhenRelativeTo: end
-
-# we prefer Perl-style regex back references
-Style/PerlBackrefs:
- Enabled: false
-
# makes diffs nicer
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
-# we won't change backward compatible method names
-Style/MethodName:
- Exclude:
- - 'Homebrew/compat/**/*'
+Style/UnneededCapitalW:
+ Enabled: false
-# we won't change backward compatible predicate names
-Style/PredicateName:
- Exclude:
- - 'Homebrew/compat/**/*'
- NameWhitelist: is_32_bit?, is_64_bit?
+# TODO: enforce when rubocop has fixed this
+# https://github.com/bbatsov/rubocop/issues/3516
+Style/VariableNumber:
+ Enabled: false
-# `formula do` uses nested method definitions
-Lint/NestedMethodDefinition:
- Exclude:
- - 'Homebrew/test/**/*'
+# TODO: enforce when rubocop has fixed this
+# https://github.com/bbatsov/rubocop/issues/1543
+Style/WordArray:
+ Enabled: false
diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml
index e11d024ae..d3be22eb5 100644
--- a/Library/.rubocop_todo.yml
+++ b/Library/.rubocop_todo.yml
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 100`
-# on 2016-09-22 20:07:41 +0200 using RuboCop version 0.43.0.
+# on 2016-09-25 02:39:38 +0200 using RuboCop version 0.43.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 18
+# Offense count: 16
Lint/HandleExceptions:
Exclude:
- 'Homebrew/cmd/install.rb'
@@ -16,7 +16,6 @@ Lint/HandleExceptions:
- 'Homebrew/cmd/upgrade.rb'
- 'Homebrew/cmd/uses.rb'
- 'Homebrew/descriptions.rb'
- - 'Homebrew/dev-cmd/test-bot.rb'
- 'Homebrew/diagnostic.rb'
- 'Homebrew/extend/ENV/super.rb'
- 'Homebrew/extend/pathname.rb'
@@ -35,12 +34,11 @@ Lint/Loop:
Exclude:
- 'Homebrew/patch.rb'
-# Offense count: 6
+# Offense count: 1
Lint/NestedMethodDefinition:
Exclude:
- 'Homebrew/test/**/*'
- 'Homebrew/dev-cmd/bottle.rb'
- - 'Homebrew/dev-cmd/test-bot.rb'
# Offense count: 28
Lint/RescueException:
@@ -67,31 +65,117 @@ Lint/ShadowedException:
Exclude:
- 'Homebrew/utils/fork.rb'
-# Offense count: 18
+# Offense count: 14
Metrics/BlockNesting:
Max: 5
-# Offense count: 20
+# Offense count: 19
# Configuration parameters: CountComments.
Metrics/ModuleLength:
- Max: 370
+ Max: 366
# Offense count: 2
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 6
-# Offense count: 1
-Style/CaseEquality:
+# Offense count: 9
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, SupportedStyles.
+# SupportedStyles: percent_q, bare_percent
+Style/BarePercentLiterals:
Exclude:
+ - 'Taps/**/*'
+ - 'Homebrew/dev-cmd/audit.rb'
+ - 'Homebrew/test/test_diagnostic.rb'
+ - 'Homebrew/test/test_exceptions.rb'
+ - 'Homebrew/test/test_integration_cmds.rb'
+ - 'Homebrew/test/test_patch.rb'
+ - 'Homebrew/test/test_string.rb'
+
+# Offense count: 136
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
+# SupportedStyles: line_count_based, semantic, braces_for_chaining
+# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
+# FunctionalMethods: let, let!, subject, watch
+# IgnoredMethods: lambda, proc, it
+Style/BlockDelimiters:
+ Exclude:
+ - 'Taps/**/*'
+ - 'Homebrew/caveats.rb'
+ - 'Homebrew/cleaner.rb'
+ - 'Homebrew/cleanup.rb'
+ - 'Homebrew/cmd/deps.rb'
+ - 'Homebrew/cmd/desc.rb'
+ - 'Homebrew/cmd/fetch.rb'
+ - 'Homebrew/cmd/help.rb'
+ - 'Homebrew/cmd/info.rb'
+ - 'Homebrew/cmd/linkapps.rb'
+ - 'Homebrew/cmd/list.rb'
+ - 'Homebrew/cmd/outdated.rb'
+ - 'Homebrew/cmd/reinstall.rb'
+ - 'Homebrew/cmd/search.rb'
+ - 'Homebrew/cmd/tap-info.rb'
+ - 'Homebrew/cmd/unlinkapps.rb'
+ - 'Homebrew/cmd/update-report.rb'
+ - 'Homebrew/cmd/upgrade.rb'
+ - 'Homebrew/cmd/uses.rb'
- 'Homebrew/compilers.rb'
+ - 'Homebrew/debrew.rb'
+ - 'Homebrew/descriptions.rb'
+ - 'Homebrew/dev-cmd/aspell-dictionaries.rb'
+ - 'Homebrew/dev-cmd/audit.rb'
+ - 'Homebrew/dev-cmd/bottle.rb'
+ - 'Homebrew/dev-cmd/edit.rb'
+ - 'Homebrew/dev-cmd/man.rb'
+ - 'Homebrew/diagnostic.rb'
+ - 'Homebrew/exceptions.rb'
+ - 'Homebrew/extend/ARGV.rb'
+ - 'Homebrew/extend/ENV/shared.rb'
+ - 'Homebrew/extend/ENV/std.rb'
+ - 'Homebrew/extend/fileutils.rb'
+ - 'Homebrew/extend/os/mac/formula_cellar_checks.rb'
+ - 'Homebrew/extend/pathname.rb'
+ - 'Homebrew/formula.rb'
+ - 'Homebrew/formula_assertions.rb'
+ - 'Homebrew/formula_cellar_checks.rb'
+ - 'Homebrew/formula_installer.rb'
+ - 'Homebrew/formulary.rb'
+ - 'Homebrew/global.rb'
+ - 'Homebrew/keg.rb'
+ - 'Homebrew/language/haskell.rb'
+ - 'Homebrew/language/node.rb'
+ - 'Homebrew/language/python.rb'
+ - 'Homebrew/migrator.rb'
+ - 'Homebrew/os/mac/linkage_checker.rb'
+ - 'Homebrew/os/mac/xquartz.rb'
+ - 'Homebrew/patch.rb'
+ - 'Homebrew/readall.rb'
+ - 'Homebrew/software_spec.rb'
+ - 'Homebrew/tap.rb'
+ - 'Homebrew/test/lib/config.rb'
+ - 'Homebrew/test/test_ARGV.rb'
+ - 'Homebrew/test/test_cleanup.rb'
+ - 'Homebrew/test/test_cmd_audit.rb'
+ - 'Homebrew/test/test_dependency_collector.rb'
+ - 'Homebrew/test/test_formula_installer.rb'
+ - 'Homebrew/test/test_formula_installer_bottle.rb'
+ - 'Homebrew/test/test_formulary.rb'
+ - 'Homebrew/test/test_gpg.rb'
+ - 'Homebrew/test/test_integration_cmds.rb'
+ - 'Homebrew/test/test_migrator.rb'
+ - 'Homebrew/test/test_pathname.rb'
+ - 'Homebrew/test/test_tap.rb'
+ - 'Homebrew/test/test_utils.rb'
+ - 'Homebrew/test/testing_env.rb'
+ - 'Homebrew/utils.rb'
+ - 'Homebrew/utils/github.rb'
-# Offense count: 11
+# Offense count: 7
Style/ClassVars:
Exclude:
- - 'Homebrew/cleanup.rb'
- 'Homebrew/dev-cmd/audit.rb'
- - 'Homebrew/dev-cmd/test-bot.rb'
- 'Homebrew/formula_installer.rb'
- 'Homebrew/test/testing_env.rb'
- 'Homebrew/utils.rb'
@@ -103,14 +187,6 @@ Style/GlobalVars:
- 'Homebrew/diagnostic.rb'
- 'Homebrew/utils.rb'
-# Offense count: 51
-# Cop supports --auto-correct.
-# Configuration parameters: MaxLineLength.
-Style/IfUnlessModifier:
- Exclude:
- - 'Taps/**/*'
- - 'Homebrew/dev-cmd/audit.rb'
-
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
@@ -118,7 +194,7 @@ Style/IfUnlessModifier:
Style/IndentArray:
EnforcedStyle: special_inside_parentheses
-# Offense count: 7
+# Offense count: 5
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: module_function, extend_self
Style/ModuleFunction:
@@ -147,16 +223,9 @@ Style/MutableConstant:
- 'Homebrew/tap.rb'
# Offense count: 9
+# Offense count: 8
Style/OpMethod:
Exclude:
- - 'Homebrew/compilers.rb'
- 'Homebrew/dependencies.rb'
- 'Homebrew/install_renamed.rb'
- 'Homebrew/options.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: SupportedStyles.
-# SupportedStyles: use_perl_names, use_english_names
-Style/SpecialGlobalVars:
- EnforcedStyle: use_perl_names
diff --git a/Library/Homebrew/.simplecov b/Library/Homebrew/.simplecov
index bc4ed7bb1..952bb466b 100755
--- a/Library/Homebrew/.simplecov
+++ b/Library/Homebrew/.simplecov
@@ -1,5 +1,7 @@
#!/usr/bin/env ruby
+require "english"
+
SimpleCov.start do
coverage_dir File.expand_path("../test/coverage", File.realpath(__FILE__))
root File.expand_path("..", File.realpath(__FILE__))
@@ -16,9 +18,9 @@ SimpleCov.start do
add_filter "/Homebrew/vendor/"
if ENV["HOMEBREW_INTEGRATION_TEST"]
- command_name "#{ENV["HOMEBREW_INTEGRATION_TEST"]} (#{$$})"
+ command_name "#{ENV["HOMEBREW_INTEGRATION_TEST"]} (#{$PROCESS_ID})"
at_exit do
- exit_code = $!.nil? ? 0 : $!.status
+ exit_code = $ERROR_INFO.nil? ? 0 : $ERROR_INFO.status
$stdout.reopen("/dev/null")
# Just save result, but don't write formatted output.
@@ -30,7 +32,7 @@ SimpleCov.start do
exit! exit_code
end
else
- command_name "#{command_name} (#{$$})"
+ command_name "#{command_name} (#{$PROCESS_ID})"
# Not using this during integration tests makes the tests 4x times faster
# without changing the coverage.
track_files "#{SimpleCov.root}/**/*.rb"
diff --git a/Library/Homebrew/cask/.rubocop.yml b/Library/Homebrew/cask/.rubocop.yml
index 96a0b0e11..4d5672789 100644
--- a/Library/Homebrew/cask/.rubocop.yml
+++ b/Library/Homebrew/cask/.rubocop.yml
@@ -9,7 +9,7 @@ Metrics/AbcSize:
Enabled: false
Metrics/ClassLength:
- Enabled: false
+ Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb
index 04a976e55..bb91fa69e 100644
--- a/Library/Homebrew/cleanup.rb
+++ b/Library/Homebrew/cleanup.rb
@@ -4,7 +4,7 @@ require "thread"
module Homebrew
module Cleanup
- @@disk_cleanup_size = 0
+ @disk_cleanup_size = 0
def self.cleanup
cleanup_cellar
@@ -17,11 +17,11 @@ module Homebrew
end
def self.update_disk_cleanup_size(path_size)
- @@disk_cleanup_size += path_size
+ @disk_cleanup_size += path_size
end
def self.disk_cleanup_size
- @@disk_cleanup_size
+ @disk_cleanup_size
end
def self.cleanup_formula(formula)
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 1a6e47dbe..9d7a3ba92 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -38,9 +38,7 @@ require "date"
module Homebrew
def audit
- if ARGV.switch? "D"
- Homebrew.inject_dump_stats!(FormulaAuditor, /^audit_/)
- end
+ Homebrew.inject_dump_stats!(FormulaAuditor, /^audit_/) if ARGV.switch? "D"
formula_count = 0
problem_count = 0
@@ -251,9 +249,7 @@ class FormulaAuditor
actual_mode & 0777, wanted_mode & 0777, formula.path)
end
- if text.data? && !text.end?
- problem "'DATA' was found, but no '__END__'"
- end
+ problem "'DATA' was found, but no '__END__'" if text.data? && !text.end?
if text.end? && !text.data?
problem "'__END__' was found, but 'DATA' is not used"
@@ -263,9 +259,7 @@ class FormulaAuditor
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
end
- unless text.trailing_newline?
- problem "File should end with a newline"
- end
+ problem "File should end with a newline" unless text.trailing_newline?
return unless @strict
@@ -742,9 +736,7 @@ class FormulaAuditor
end
# Commented-out cmake support from default template
- if line.include?('# system "cmake')
- problem "Commented cmake call found"
- end
+ problem "Commented cmake call found" if line.include?('# system "cmake')
# Comments from default template
[
@@ -757,9 +749,8 @@ class FormulaAuditor
"# if your formula fails when building in parallel",
"# Remove unrecognized options if warned by configure",
].each do |comment|
- if line.include? comment
- problem "Please remove default template comments"
- end
+ next unless line.include?(comment)
+ problem "Please remove default template comments"
end
# FileUtils is included in Formula
@@ -814,26 +805,18 @@ class FormulaAuditor
end
# Commented-out depends_on
- if line =~ /#\s*depends_on\s+(.+)\s*$/
- problem "Commented-out dep #{$1}"
- end
+ problem "Commented-out dep #{$1}" if line =~ /#\s*depends_on\s+(.+)\s*$/
# No trailing whitespace, please
- if line =~ /[\t ]+$/
- problem "#{lineno}: Trailing whitespace was found"
- end
+ problem "#{lineno}: Trailing whitespace was found" if line =~ /[\t ]+$/
if line =~ /if\s+ARGV\.include\?\s+'--(HEAD|devel)'/
problem "Use \"if build.#{$1.downcase}?\" instead"
end
- if line.include?("make && make")
- problem "Use separate make calls"
- end
+ problem "Use separate make calls" if line.include?("make && make")
- if line =~ /^[ ]*\t/
- problem "Use spaces instead of tabs for indentation"
- end
+ problem "Use spaces instead of tabs for indentation" if line =~ /^[ ]*\t/
if line.include?("ENV.x11")
problem "Use \"depends_on :x11\" instead of \"ENV.x11\""
@@ -892,9 +875,7 @@ class FormulaAuditor
problem "Use build instead of ARGV to check options"
end
- if line.include?("def options")
- problem "Use new-style option definitions"
- end
+ problem "Use new-style option definitions" if line.include?("def options")
if line.end_with?("def test")
problem "Use new-style test definitions (test do)"
@@ -970,9 +951,7 @@ class FormulaAuditor
end
end
- if line =~ /(require ["']formula["'])/
- problem "`#{$1}` is now unnecessary"
- end
+ problem "`#{$1}` is now unnecessary" if line =~ /(require ["']formula["'])/
if line =~ %r{#\{share\}/#{Regexp.escape(formula.name)}[/'"]}
problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}"
@@ -1161,9 +1140,7 @@ class ResourceAuditor
if using == :cvs
mod = specs[:module]
- if mod == name
- problem "Redundant :module value in URL"
- end
+ problem "Redundant :module value in URL" if mod == name
if url =~ %r{:[^/]+$}
mod = url.split(":").last
@@ -1264,9 +1241,7 @@ class ResourceAuditor
problem "Don't use specific dl mirrors in SourceForge urls (url is #{p})."
end
- if p.start_with? "http://downloads"
- problem "Please use https:// for #{p}"
- end
+ problem "Please use https:// for #{p}" if p.start_with? "http://downloads"
end
# Debian has an abundance of secure mirrors. Let's not pluck the insecure