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 #4124 - bundler:seg-rubocop, r=indirect
Browse files Browse the repository at this point in the history
More rubocop_todo cleanup
  • Loading branch information
homu committed Nov 27, 2015
2 parents 50731b9 + 046f283 commit 437f604
Show file tree
Hide file tree
Showing 69 changed files with 296 additions and 469 deletions.
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ Style/AccessModifierIndentation:
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation

Style/MultilineBlockChain:
Enabled: false

Style/MultilineOperationIndentation:
EnforcedStyle: indented

Style/PerlBackrefs:
Enabled: false

Style/SingleLineBlockParams:
Enabled: false

Style/SpaceInsideBlockBraces:
SpaceBeforeBlockParameters: false

Expand Down
155 changes: 0 additions & 155 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ Lint/NestedMethodDefinition:
Exclude:
- 'lib/bundler/graph.rb'

# Offense count: 1
Lint/NonLocalExitFromIterator:
Exclude:
- 'lib/bundler/rubygems_integration.rb'

# Offense count: 5
Lint/RescueException:
Exclude:
Expand Down Expand Up @@ -66,41 +61,13 @@ Style/AccessorMethodName:
Exclude:
- 'lib/bundler/source/git.rb'

# Offense count: 16
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AndOr:
Exclude:
- 'lib/bundler/gem_helper.rb'
- 'lib/bundler/graph.rb'
- 'lib/bundler/lazy_specification.rb'
- 'lib/bundler/match_platform.rb'
- 'lib/bundler/remote_specification.rb'
- 'lib/bundler/resolver.rb'
- 'lib/bundler/rubygems_integration.rb'
- 'lib/bundler/runtime.rb'
- 'lib/bundler/settings.rb'
- 'spec/support/builders.rb'

# Offense count: 24
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
Style/BlockDelimiters:
Enabled: false

# Offense count: 3
Style/CaseEquality:
Exclude:
- 'lib/bundler/dsl.rb'
- 'lib/bundler/match_platform.rb'
- 'lib/bundler/rubygems_ext.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
Style/CaseIndentation:
Enabled: false

# Offense count: 22
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Expand All @@ -111,29 +78,6 @@ Style/ClassAndModuleChildren:
Style/Documentation:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyElse:
Exclude:
- 'lib/bundler/fetcher.rb'
- 'lib/bundler/ruby_version.rb'

# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundModuleBody:
Exclude:
- 'lib/bundler/cli/common.rb'
- 'lib/bundler/deprecate.rb'
- 'lib/bundler/dsl.rb'
- 'lib/bundler/fetcher.rb'
- 'lib/bundler/friendly_errors.rb'
- 'lib/bundler/gem_helpers.rb'
- 'spec/support/builders.rb'
- 'spec/support/indexes.rb'
- 'spec/support/rubygems_ext.rb'

# Offense count: 1
# Configuration parameters: Exclude.
Style/FileName:
Expand All @@ -153,83 +97,12 @@ Style/GlobalVars:
Style/GuardClause:
Enabled: false

# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
Exclude:
- 'lib/bundler.rb'
- 'lib/bundler/cli/install.rb'
- 'lib/bundler/definition.rb'
- 'lib/bundler/dependency.rb'
- 'lib/bundler/fetcher.rb'
- 'lib/bundler/gem_helper.rb'
- 'lib/bundler/lockfile_parser.rb'
- 'lib/bundler/rubygems_integration.rb'
- 'lib/bundler/settings.rb'
- 'lib/bundler/source/git.rb'
- 'lib/bundler/source/git/git_proxy.rb'
- 'spec/support/builders.rb'

# Offense count: 2
Style/ModuleFunction:
Exclude:
- 'lib/bundler/shared_helpers.rb'
- 'spec/support/path.rb'

# Offense count: 1
Style/MultilineBlockChain:
Exclude:
- 'spec/support/less_than_proc.rb'

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

# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Exclude:
- 'exe/bundle'
- 'exe/bundler'
- 'lib/bundler/definition.rb'
- 'lib/bundler/dsl.rb'
- 'lib/bundler/resolver.rb'
- 'lib/bundler/source/path.rb'
- 'spec/support/artifice/endpoint.rb'

# Offense count: 13
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
- 'lib/bundler/dsl.rb'
- 'lib/bundler/shared_helpers.rb'
- 'lib/bundler/ui/shell.rb'
- 'spec/bundler/bundler_spec.rb'
- 'spec/support/helpers.rb'

# Offense count: 67
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false

# Offense count: 22
# Cop supports --auto-correct.
Style/PerlBackrefs:
Exclude:
- 'exe/bundle'
- 'exe/bundler'
- 'lib/bundler/cli/gem.rb'
- 'lib/bundler/dsl.rb'
- 'lib/bundler/lockfile_parser.rb'
- 'lib/bundler/runtime.rb'
- 'lib/bundler/source/git/git_proxy.rb'
- 'lib/bundler/source/path.rb'

# Offense count: 8
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
Style/PredicateName:
Expand All @@ -245,31 +118,3 @@ Style/PredicateName:
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/RaiseArgs:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Style/RedundantSelf:
Exclude:
- 'lib/bundler.rb'
- 'lib/bundler/definition.rb'
- 'lib/bundler/graph.rb'
- 'lib/bundler/rubygems_integration.rb'
- 'lib/bundler/source/rubygems.rb'
- 'spec/support/less_than_proc.rb'
- 'spec/support/ruby_ext.rb'

# Offense count: 6
# Cop supports --auto-correct.
Style/RescueModifier:
Exclude:
- 'lib/bundler.rb'
- 'lib/bundler/fetcher.rb'
- 'lib/bundler/resolver.rb'
- 'spec/realworld/dependency_api_spec.rb'
- 'spec/realworld/gemfile_source_header_spec.rb'

# Offense count: 1
# Configuration parameters: Methods.
Style/SingleLineBlockParams:
Exclude:
- 'lib/bundler/cli/gem.rb'
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ namespace :spec do
end

deps.sort_by {|name, _| name }.each do |name, version|
sh %{#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || } +
%{#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc}
sh %(#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || ) +
%(#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc)
end

# Download and install gems used inside tests
Expand Down Expand Up @@ -99,14 +99,14 @@ begin
end

desc "Run the real-world spec suite (requires internet)"
task :realworld => %w[set_realworld spec]
task :realworld => %w(set_realworld spec)

task :set_realworld do
ENV["BUNDLER_REALWORLD_TESTS"] = "1"
end

desc "Run the spec suite with the sudo tests"
task :sudo => %w[set_sudo spec clean_sudo]
task :sudo => %w(set_sudo spec clean_sudo)

task :set_sudo do
ENV["BUNDLER_SUDO_TESTS"] = "1"
Expand Down
11 changes: 5 additions & 6 deletions exe/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ Signal.trap("INT") { exit 1 }
require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
err = "Looks like you have a version of bundler that's older than 0.9.\n"
err << "Please remove your old versions.\n"
err << "An easy way to do this is by running `gem cleanup bundler`."
abort(err)
end
next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
err = "Looks like you have a version of bundler that's older than 0.9.\n"
err << "Please remove your old versions.\n"
err << "An easy way to do this is by running `gem cleanup bundler`."
abort(err)
end

require "bundler/friendly_errors"
Expand Down
11 changes: 5 additions & 6 deletions exe/bundler
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ Signal.trap("INT") { exit 1 }
require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
err = "Looks like you have a version of bundler that's older than 0.9.\n"
err << "Please remove your old versions.\n"
err << "An easy way to do this is by running `gem cleanup bundler`."
abort(err)
end
next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
err = "Looks like you have a version of bundler that's older than 0.9.\n"
err << "Please remove your old versions.\n"
err << "An easy way to do this is by running `gem cleanup bundler`."
abort(err)
end

require "bundler/friendly_errors"
Expand Down
12 changes: 7 additions & 5 deletions lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def app_config_path

def app_cache(custom_path = nil)
path = custom_path || root
path.join(self.settings.app_cache_path)
path.join(settings.app_cache_path)
end

def tmp(name = Process.pid.to_s)
Expand Down Expand Up @@ -252,9 +252,7 @@ def system_bindir
def requires_sudo?
return @requires_sudo if defined?(@requires_sudo_ran)

if settings.allow_sudo?
sudo_present = which "sudo"
end
sudo_present = which "sudo" if settings.allow_sudo?

if sudo_present
# the bundle path and subdirectories need to be writable for Rubygems
Expand Down Expand Up @@ -412,7 +410,11 @@ def configure_gem_home_and_path

def configure_gem_home
# TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
FileUtils.mkdir_p bundle_path.to_s rescue nil
begin
FileUtils.mkdir_p bundle_path.to_s
rescue
nil
end

ENV["GEM_HOME"] = File.expand_path(bundle_path, root)
Bundler.rubygems.clear_paths
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module Bundler
class CLI < Thor
include Thor::Actions
AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean]
AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean)

def self.start(*)
super
Expand Down
1 change: 0 additions & 1 deletion lib/bundler/cli/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@ def self.gem_not_found_message(missing_gem_name, alternatives)
message += "\nDid you mean #{suggestions}?" if suggestions
message
end

end
end
4 changes: 2 additions & 2 deletions lib/bundler/cli/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def run
"bin/setup.tt" => "bin/setup"
}

executables = %w[
executables = %w(
bin/console
bin/setup
]
)

if test_framework = ask_and_set_test_framework
config[:test] = test_framework
Expand Down
4 changes: 1 addition & 3 deletions lib/bundler/cli/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ def run
"before deploying."
end

if Bundler.app_cache.exist?
options[:local] = true
end
options[:local] = true if Bundler.app_cache.exist?

Bundler.settings[:frozen] = "1"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def run

spec_version = "#{active_spec.version}#{active_spec.git_version}"
current_version = "#{current_spec.version}#{current_spec.git_version}"
dependency_version = %|, requested #{dependency.requirement}| if dependency && dependency.specific?
dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?

if dependency
groups = dependency.groups.join(", ")
Expand Down
Loading

0 comments on commit 437f604

Please sign in to comment.