From 719a9c31e2ca4e454f4494a4544beb6c5db4555f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sun, 3 Mar 2019 11:43:17 +0100 Subject: Fully enable some dependent Layout cops These cops leave weird styling if enabled separately, but do what you want if enabled all together. So fix all remaining style issues for them at once. --- .rubocop_todo.yml | 27 --------------------------- lib/bundler/dsl.rb | 8 ++++---- lib/bundler/resolver.rb | 20 ++++++++++---------- lib/bundler/source/path.rb | 8 ++++---- 4 files changed, 18 insertions(+), 45 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 80d5f9b4cc..52b93d223f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -70,29 +70,11 @@ Layout/ClosingHeredocIndentation: - 'spec/lock/lockfile_spec.rb' - 'spec/other/platform_spec.rb' -# Offense count: 5 -# Cop supports --auto-correct. -Layout/ElseAlignment: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/resolver.rb' - - 'lib/bundler/source/path.rb' - # Offense count: 290 # Cop supports --auto-correct. Layout/EmptyLineAfterGuardClause: Enabled: false -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity. -# SupportedStylesAlignWith: keyword, variable, start_of_line -Layout/EndAlignment: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/resolver.rb' - - 'lib/bundler/source/path.rb' - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: IndentationWidth. @@ -107,15 +89,6 @@ Layout/IndentArray: Layout/IndentHeredoc: Enabled: false -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: Width, IgnoredPatterns. -Layout/IndentationWidth: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/resolver.rb' - - 'lib/bundler/source/path.rb' - # Offense count: 3 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 6f0d361160..69dcc6427f 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -441,10 +441,10 @@ repo_name ||= user_name message = String.new message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " message << if invalid_keys.size > 1 - "as options for #{command}, but they are invalid." - else - "as an option for #{command}, but it is invalid." - end + "as options for #{command}, but they are invalid." + else + "as an option for #{command}, but it is invalid." + end message << " Valid options are: #{valid_keys.join(", ")}." message << " You may be able to resolve this by upgrading Bundler to the newest version." diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index aaa7bb7583..96ff5473fe 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -279,10 +279,10 @@ module Bundler versions_with_platforms = specs.map {|s| [s.version, s.platform] } message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n") message << if versions_with_platforms.any? - "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" - else - "The source does not contain any versions of '#{name}'" - end + "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" + else + "The source does not contain any versions of '#{name}'" + end else message = "Could not find gem '#{requirement}' in any of the gem sources " \ "listed in your Gemfile#{cache_message}." @@ -375,12 +375,12 @@ module Bundler o << " " o << if relevant_sources.empty? - "in any of the sources.\n" - elsif metadata_requirement - "is not available in #{relevant_sources.join(" or ")}" - else - "in any of the relevant sources:\n #{relevant_sources * "\n "}\n" - end + "in any of the sources.\n" + elsif metadata_requirement + "is not available in #{relevant_sources.join(" or ")}" + else + "in any of the relevant sources:\n #{relevant_sources * "\n "}\n" + end end end, :version_for_spec => lambda {|spec| spec.version }, diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index ed734bf549..5f3f1bc2e4 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -191,10 +191,10 @@ module Bundler else message = String.new("The path `#{expanded_path}` ") message << if File.exist?(expanded_path) - "is not a directory." - else - "does not exist." - end + "is not a directory." + else + "does not exist." + end raise PathError, message end -- cgit v1.2.1