summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-10-06 19:16:57 +0000
committerThe Bundler Bot <bot@bundler.io>2017-10-06 19:16:57 +0000
commit6a3b09b2292405cab6b5f4d63004b5c8b782b469 (patch)
tree12c924a595786279bd465c983a22062a7b91ba83
parent691ecac3053d4a1c62b9e7a3a77f39b2cb7607f1 (diff)
parentdc0f057d0a34f15ae69c220d06682f35266afbc7 (diff)
downloadbundler-6a3b09b2292405cab6b5f4d63004b5c8b782b469.tar.gz
Auto merge of #6054 - walf443:improve_rubocop_todo, r=segiddins
improve .rubocop_todo.yml ### What was the end-user problem that led to this PR? No ### What was your diagnosis of the problem? No ### What is your fix for the problem, implemented in this PR? My fix reduce ruboco_todo.yml lines. - Style/EmptyLinesAroundExceptionHandlingKeywords - Style/SpaceAroundOperators - Style/SpaceInsideBlockBraces - Lint/DuplicateMethods - Lint/Void - Style/IfUnlessModifier - Style/MixinGrouping - Style/NestedParenthesizedCalls - Style/OrAssignment - Style/RedundantParentheses - Style/TernaryParentheses
-rw-r--r--.rubocop_todo.yml78
-rw-r--r--Rakefile2
-rw-r--r--lib/bundler/cli/common.rb2
-rw-r--r--lib/bundler/cli/console.rb2
-rw-r--r--lib/bundler/dsl.rb4
-rw-r--r--lib/bundler/gem_version_promoter.rb2
-rw-r--r--lib/bundler/installer/parallel_installer.rb4
-rw-r--r--lib/bundler/resolver.rb2
-rw-r--r--lib/bundler/retry.rb2
-rw-r--r--lib/bundler/rubygems_ext.rb2
-rw-r--r--lib/bundler/spec_set.rb4
-rw-r--r--lib/bundler/ui/shell.rb2
-rw-r--r--spec/commands/lock_spec.rb2
-rw-r--r--spec/runtime/setup_spec.rb2
14 files changed, 15 insertions, 95 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 472c641f55..6658ae4bb9 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -6,12 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 2
-# Cop supports --auto-correct.
-Layout/EmptyLinesAroundExceptionHandlingKeywords:
- Exclude:
- - 'Rakefile'
-
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
@@ -35,22 +29,6 @@ Layout/MultilineMethodCallIndentation:
- 'lib/bundler/cli/common.rb'
- 'spec/bundler/plugin/source_list_spec.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment.
-Layout/SpaceAroundOperators:
- Exclude:
- - 'lib/bundler/retry.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
-# SupportedStyles: space, no_space
-# SupportedStylesForEmptyBraces: space, no_space
-Layout/SpaceInsideBlockBraces:
- Exclude:
- - 'lib/bundler/installer/parallel_installer.rb'
-
# Offense count: 31
Lint/AmbiguousBlockAssociation:
Exclude:
@@ -67,11 +45,6 @@ Lint/AmbiguousBlockAssociation:
- 'spec/support/helpers.rb'
- 'spec/support/indexes.rb'
-# Offense count: 1
-Lint/DuplicateMethods:
- Exclude:
- - 'lib/bundler/rubygems_ext.rb'
-
# Offense count: 2
Lint/EmptyWhen:
Exclude:
@@ -135,11 +108,6 @@ Lint/UselessAssignment:
- 'lib/bundler/index.rb'
- 'lib/bundler/installer.rb'
-# Offense count: 1
-Lint/Void:
- Exclude:
- - 'lib/bundler/spec_set.rb'
-
# Offense count: 2564
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
@@ -316,13 +284,6 @@ Style/GuardClause:
- 'spec/commands/newgem_spec.rb'
- 'spec/support/sometimes.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: MaxLineLength.
-Style/IfUnlessModifier:
- Exclude:
- - 'lib/bundler/dsl.rb'
-
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: InverseMethods, InverseBlocks.
@@ -345,14 +306,6 @@ Style/MethodMissing:
- 'lib/bundler/remote_specification.rb'
- 'spec/support/builders.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: separated, grouped
-Style/MixinGrouping:
- Exclude:
- - 'lib/bundler/spec_set.rb'
-
# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: module_function, extend_self
@@ -372,16 +325,6 @@ Style/MultilineIfModifier:
- 'lib/bundler/runtime.rb'
- 'lib/bundler/source/rubygems.rb'
-# Offense count: 3
-# Cop supports --auto-correct.
-# Configuration parameters: Whitelist.
-# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
-Style/NestedParenthesizedCalls:
- Exclude:
- - 'lib/bundler/resolver.rb'
- - 'spec/commands/lock_spec.rb'
- - 'spec/runtime/setup_spec.rb'
-
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
@@ -393,12 +336,6 @@ Style/NumericPredicate:
- 'lib/bundler/mirror.rb'
- 'lib/bundler/source/path.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/OrAssignment:
- Exclude:
- - 'lib/bundler/ui/shell.rb'
-
# Offense count: 24
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -421,21 +358,6 @@ Style/RaiseArgs:
- 'spec/bundler/rubygems_integration_spec.rb'
- 'spec/bundler/shared_helpers_spec.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/RedundantParentheses:
- Exclude:
- - 'lib/bundler/cli/console.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment.
-# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
-Style/TernaryParentheses:
- Exclude:
- - 'lib/bundler/cli/common.rb'
- - 'lib/bundler/gem_version_promoter.rb'
-
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
diff --git a/Rakefile b/Rakefile
index b7a5932cb2..645c98c442 100644
--- a/Rakefile
+++ b/Rakefile
@@ -246,7 +246,6 @@ begin
end
end
end
-
rescue LoadError
task :spec do
abort "Run `rake spec:deps` to be able to run the specs"
@@ -314,7 +313,6 @@ begin
task(:require) {}
end
-
rescue LoadError
namespace :man do
task(:require) { abort "Install the ronn gem to be able to release!" }
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 350f3eb5c9..8084405b38 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -23,7 +23,7 @@ module Bundler
groups = Bundler.settings[:without]
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
reject {|s| s.to_s.empty? }.join(" and ")
- group_str = (groups.size == 1) ? "group" : "groups"
+ group_str = groups.size == 1 ? "group" : "groups"
"Gems in the #{group_str} #{group_list} were not installed."
end
diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb
index 853eca8358..6e0dfe28af 100644
--- a/lib/bundler/cli/console.rb
+++ b/lib/bundler/cli/console.rb
@@ -12,7 +12,7 @@ module Bundler
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem <name>`"
- group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require
+ group ? Bundler.require(:default, *group.split.map!(&:to_sym)) : Bundler.require
ARGV.clear
console = get_console(Bundler.settings[:console] || "irb")
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 8681163277..37bfe36740 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -347,9 +347,7 @@ repo_name ||= user_name
if name =~ /\s/
raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
end
- if name.empty?
- raise GemfileError, %(an empty gem name is not valid)
- end
+ raise GemfileError, %(an empty gem name is not valid) if name.empty?
normalize_hash(opts)
diff --git a/lib/bundler/gem_version_promoter.rb b/lib/bundler/gem_version_promoter.rb
index a52c9cce2b..8d412c2cc0 100644
--- a/lib/bundler/gem_version_promoter.rb
+++ b/lib/bundler/gem_version_promoter.rb
@@ -106,7 +106,7 @@ module Bundler
must_match = minor? ? [0] : [0, 1]
matches = must_match.map {|idx| gsv.segments[idx] == lsv.segments[idx] }
- (matches.uniq == [true]) ? (gsv >= lsv) : false
+ matches.uniq == [true] ? (gsv >= lsv) : false
else
true
end
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index 7a8003140b..e6e81fddff 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -115,7 +115,7 @@ module Bundler
s,
s.missing_lockfile_dependencies(@specs.map(&:name)),
]
- end.reject { |a| a.last.empty? }
+ end.reject {|a| a.last.empty? }
return if missing_dependencies.empty?
warning = []
@@ -150,7 +150,7 @@ module Bundler
end
def worker_pool
- @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
+ @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda {|spec_install, worker_num|
do_install(spec_install, worker_num)
}
end
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 5adc8ecbd8..965a1d55ad 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -323,7 +323,7 @@ module Bundler
:additional_message_for_conflict => lambda do |o, name, conflict|
if name == "bundler"
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
- other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new Bundler::VERSION)
+ other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
end
if name == "bundler" && other_bundler_required
diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb
index 244606dcc9..5e4f0c502d 100644
--- a/lib/bundler/retry.rb
+++ b/lib/bundler/retry.rb
@@ -35,7 +35,7 @@ module Bundler
private
def run(&block)
- @failed = false
+ @failed = false
@current_run += 1
@result = block.call
rescue => e
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index e9f0eac355..d746bdb41b 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -34,7 +34,9 @@ module Gem
(defined?(@source) && @source) || Gem::Source::Installed.new
end
else
+ # rubocop:disable Lint/DuplicateMethods
attr_accessor :source
+ # rubocop:enable Lint/DuplicateMethods
end
alias_method :rg_full_gem_path, :full_gem_path
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 7cd3021997..4674936d39 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -7,7 +7,8 @@ require "set"
module Bundler
class SpecSet
extend Forwardable
- include TSort, Enumerable
+ include Enumerable
+ include TSort
def_delegators :@specs, :<<, :length, :add, :remove, :size, :empty?
def_delegators :sorted, :each
@@ -61,7 +62,6 @@ module Bundler
@specs << value
@lookup = nil
@sorted = nil
- value
end
def sort!
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 3b3b6bfb53..fdf073ffb8 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -109,7 +109,7 @@ module Bundler
end
def tell_err(message, color = nil, newline = nil)
- newline = message.to_s !~ /( |\t)\Z/ unless newline
+ newline ||= message.to_s !~ /( |\t)\Z/
message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap]
color = nil if color && !$stderr.tty?
diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb
index b16a828cad..8edbb95b0f 100644
--- a/spec/commands/lock_spec.rb
+++ b/spec/commands/lock_spec.rb
@@ -93,7 +93,7 @@ RSpec.describe "bundle lock" do
bundle "lock --lockfile=lock"
expect(out).to match(/Writing lockfile to.+lock/)
- expect(read_lockfile "lock").to eq(@lockfile)
+ expect(read_lockfile("lock")).to eq(@lockfile)
expect { read_lockfile }.to raise_error(Errno::ENOENT)
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 0ea07c7b0a..7c84388766 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -827,7 +827,7 @@ end
it "should clean $LOAD_PATH properly" do
gem_name = "very_simple_binary"
full_gem_name = gem_name + "-1.0"
- ext_dir = File.join(tmp "extenstions", full_gem_name)
+ ext_dir = File.join(tmp("extenstions", full_gem_name))
install_gem full_gem_name