Skip to content

Commit

Permalink
Auto merge of rubygems#6054 - walf443:improve_rubocop_todo, r=segiddins
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bundlerbot committed Oct 6, 2017
2 parents 691ecac + dc0f057 commit 6a3b09b
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 95 deletions.
78 changes: 0 additions & 78 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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!" }
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.without_groups_message
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

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def run
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")
Expand Down
4 changes: 1 addition & 3 deletions lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ def normalize_options(name, version, opts)
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)

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/gem_version_promoter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def filter_dep_specs(spec_groups, locked_spec)
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
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/installer/parallel_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def check_for_corrupt_lockfile
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 = []
Expand Down Expand Up @@ -150,7 +150,7 @@ def install_serially
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
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def version_conflict_message(e)
: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
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/retry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def attempt(&block)
private

def run(&block)
@failed = false
@failed = false
@current_run += 1
@result = block.call
rescue => e
Expand Down
2 changes: 2 additions & 0 deletions lib/bundler/rubygems_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def source
(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
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
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
Expand Down Expand Up @@ -61,7 +62,6 @@ def []=(key, value)
@specs << value
@lookup = nil
@sorted = nil
value
end

def sort!
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/ui/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def tell_me(msg, color = nil, newline = nil)
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?
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/lock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def read_lockfile(file = "Gemfile.lock")
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

Expand Down
2 changes: 1 addition & 1 deletion spec/runtime/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ def clean_load_path(lp)
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

Expand Down

0 comments on commit 6a3b09b

Please sign in to comment.