summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-03 11:43:17 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-04 00:26:03 +0100
commit719a9c31e2ca4e454f4494a4544beb6c5db4555f (patch)
tree3ac3e5e0851fb5e0cff2b6c1dabbb017d2c490d6
parentd910751543ed58c00e85a6ca5e48bd7d776dafbd (diff)
downloadbundler-719a9c31e2ca4e454f4494a4544beb6c5db4555f.tar.gz
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.
-rw-r--r--.rubocop_todo.yml27
-rw-r--r--lib/bundler/dsl.rb8
-rw-r--r--lib/bundler/resolver.rb20
-rw-r--r--lib/bundler/source/path.rb8
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