Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #3923 - Koronen:fix-style-offences, r=segiddins
Browse files Browse the repository at this point in the history
Fix a bunch of style offences

Most of these were low-hanging fruit, fixable by using RuboCop's auto-correct feature.
  • Loading branch information
homu committed Aug 14, 2015
2 parents e6c4b30 + 22a3651 commit bc87d05
Show file tree
Hide file tree
Showing 46 changed files with 148 additions and 324 deletions.
181 changes: 0 additions & 181 deletions .rubocop_todo.yml
Expand Up @@ -75,17 +75,6 @@ Style/AndOr:
Style/BlockDelimiters:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/BlockEndNewline:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
Enabled: false

# Offense count: 3
Style/CaseEquality:
Enabled: false
Expand All @@ -101,39 +90,6 @@ Style/CaseIndentation:
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassCheck:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/ClosingParenthesisIndentation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/ColonMethodCall:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerBackticks.
Style/CommandLiteral:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Keywords.
Style/CommentAnnotation:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/DeprecatedHashMethods:
Enabled: false

# Offense count: 153
Style/Documentation:
Enabled: false
Expand All @@ -144,32 +100,17 @@ Style/Documentation:
Style/EmptyElse:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyLinesAroundMethodBody:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundModuleBody:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/EmptyLiteral:
Enabled: false

# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
Enabled: false

# Offense count: 3
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/For:
Enabled: false

# Offense count: 4
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Expand All @@ -186,49 +127,6 @@ Style/GuardClause:
Style/IfUnlessModifier:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/IndentArray:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentationConsistency:
Enabled: false

# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: Width.
Style/IndentationWidth:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/InfiniteLoop:
Enabled: false

# Offense count: 4
# Cop supports --auto-correct.
Style/LeadingCommentSpace:
Enabled: false

# Offense count: 4
# Cop supports --auto-correct.
Style/LineEndConcatenation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MethodDefParentheses:
Enabled: false

# Offense count: 2
Style/ModuleFunction:
Enabled: false
Expand All @@ -237,64 +135,17 @@ Style/ModuleFunction:
Style/MultilineBlockChain:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/MultilineBlockLayout:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/MultilineIfThen:
Enabled: false

# Offense count: 13
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MultilineOperationIndentation:
Enabled: false

# Offense count: 4
Style/MultilineTernaryOperator:
Enabled: false

# Offense count: 5
# Cop supports --auto-correct.
Style/NegatedIf:
Enabled: false

# Offense count: 1
Style/NestedTernaryOperator:
Enabled: false

# Offense count: 10
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/Not:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 8

# Offense count: 1
Style/OneLineConditional:
Enabled: false

# Offense count: 5
Style/OpMethod:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment.
Style/ParenthesesAroundCondition:
Enabled: false

# Offense count: 63
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Expand All @@ -311,27 +162,11 @@ Style/PerlBackrefs:
Style/PredicateName:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/Proc:
Enabled: false

# Offense count: 8
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/RaiseArgs:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantBegin:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Style/RedundantSelf:
Expand Down Expand Up @@ -361,19 +196,3 @@ Style/SpaceInsideStringInterpolation:
# Cop supports --auto-correct.
Style/TrailingUnderscoreVariable:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/WhileUntilDo:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Style/WhileUntilModifier:
Enabled: false
4 changes: 2 additions & 2 deletions bundler.gemspec
Expand Up @@ -10,8 +10,8 @@ Gem::Specification.new do |s|
s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
s.email = ["andre.arko+terence.lee@gmail.com"]
s.homepage = "http://bundler.io"
s.summary = %q{The best way to manage your application's dependencies}
s.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
s.summary = "The best way to manage your application's dependencies"
s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"

s.required_ruby_version = ">= 1.8.7"
s.required_rubygems_version = ">= 1.3.6"
Expand Down
8 changes: 5 additions & 3 deletions lib/bundler.rb
Expand Up @@ -222,9 +222,11 @@ def root
end

def app_config_path
ENV["BUNDLE_APP_CONFIG"] ?
Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root) :
if ENV["BUNDLE_APP_CONFIG"]
Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root)
else
root.join(".bundle")
end
end

def app_cache(custom_path = nil)
Expand Down Expand Up @@ -259,7 +261,7 @@ def with_clean_env
with_original_env do
ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"]
ENV.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
if ENV.has_key? "RUBYOPT"
if ENV.key? "RUBYOPT"
ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", ""
ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-I#{File.expand_path("..", __FILE__)}", ""
end
Expand Down
54 changes: 27 additions & 27 deletions lib/bundler/cli.rb
Expand Up @@ -48,15 +48,15 @@ def help(cli = nil)
end

manpages = %w(
bundle
bundle-config
bundle-exec
bundle-gem
bundle-install
bundle-package
bundle-update
bundle-platform
gemfile.5)
bundle
bundle-config
bundle-exec
bundle-gem
bundle-install
bundle-package
bundle-update
bundle-platform
gemfile.5)

if manpages.include?(command)
root = File.expand_path("../man", __FILE__)
Expand Down Expand Up @@ -411,24 +411,24 @@ def env

private

# Automatically invoke `bundle install` and resume if
# Bundler.settings[:auto_install] exists. This is set through config cmd
# `bundle config auto_install 1`.
#
# Note that this method `nil`s out the global Definition object, so it
# should be called first, before you instantiate anything like an
# `Installer` that'll keep a reference to the old one instead.
def auto_install
return unless Bundler.settings[:auto_install]

begin
Bundler.definition.specs
rescue GemNotFound
Bundler.ui.info "Automatically installing missing gems."
Bundler.reset!
invoke :install, []
Bundler.reset!
end
# Automatically invoke `bundle install` and resume if
# Bundler.settings[:auto_install] exists. This is set through config cmd
# `bundle config auto_install 1`.
#
# Note that this method `nil`s out the global Definition object, so it
# should be called first, before you instantiate anything like an
# `Installer` that'll keep a reference to the old one instead.
def auto_install
return unless Bundler.settings[:auto_install]

begin
Bundler.definition.specs
rescue GemNotFound
Bundler.ui.info "Automatically installing missing gems."
Bundler.reset!
invoke :install, []
Bundler.reset!
end
end
end
end
2 changes: 1 addition & 1 deletion lib/bundler/cli/gem.rb
Expand Up @@ -195,7 +195,7 @@ def bundler_dependency_version
req.join(".")
end

def ensure_safe_gem_name name, constant_array
def ensure_safe_gem_name(name, constant_array)
if name =~ /^\d/
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
exit 1
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/cli/install.rb
Expand Up @@ -50,8 +50,8 @@ def run
exit 1
end

if (options["trust-policy"])
unless (Bundler.rubygems.security_policies.keys.include?(options["trust-policy"]))
if options["trust-policy"]
unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
"The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/outdated.rb
Expand Up @@ -32,7 +32,7 @@ def run

out_count = 0
# Loop through the current specs
gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.has_key? spec.name }
gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
[gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
next if !gems.empty? && !gems.include?(current_spec.name)

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/show.rb
Expand Up @@ -23,7 +23,7 @@ def run
spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
return unless spec
path = spec.full_gem_path
if !File.directory?(path)
unless File.directory?(path)
Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at:"
end
end
Expand Down

0 comments on commit bc87d05

Please sign in to comment.