diff options
| author | Mike McQuaid | 2016-09-27 12:49:34 +0100 |
|---|---|---|
| committer | GitHub | 2016-09-27 12:49:34 +0100 |
| commit | 4488eddf910e3a9e5f7fdbf55055375be13f0ae5 (patch) | |
| tree | 3c413475a7d6b7e144ae7e97d8dc360d0b108629 /Library/Homebrew | |
| parent | 0ffc9de47820a03c7207c4a0a61fbb39c14927d6 (diff) | |
| parent | b114db13d57e511ac73bddc907bfa4f8b4845635 (diff) | |
| download | brew-4488eddf910e3a9e5f7fdbf55055375be13f0ae5.tar.bz2 | |
Merge pull request #1128 from reitermarkus/rubocop
RuboCop changes.
Diffstat (limited to 'Library/Homebrew')
| -rwxr-xr-x | Library/Homebrew/.simplecov | 8 | ||||
| -rw-r--r-- | Library/Homebrew/cask/.rubocop.yml | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cleanup.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 53 |
4 files changed, 23 insertions, 46 deletions
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 |
