summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2015-11-26 12:21:10 -0600
committerSamuel Giddins <segiddins@segiddins.me>2015-11-26 12:21:10 -0600
commitbf5c235523b98bad8e69b172f0d9bc02b8616604 (patch)
treec06c020ab3b7475347e80d12047fb6cea99a075e
parentd5f3f861f273ae95cba12a0e6b230005e1061964 (diff)
downloadbundler-bf5c235523b98bad8e69b172f0d9bc02b8616604.tar.gz
[RuboCop] Enable Style/AndOr
-rw-r--r--.rubocop_todo.yml16
-rw-r--r--lib/bundler/gem_helper.rb2
-rw-r--r--lib/bundler/graph.rb4
-rw-r--r--lib/bundler/lazy_specification.rb4
-rw-r--r--lib/bundler/match_platform.rb4
-rw-r--r--lib/bundler/remote_specification.rb2
-rw-r--r--lib/bundler/resolver.rb4
-rw-r--r--lib/bundler/rubygems_integration.rb4
-rw-r--r--lib/bundler/runtime.rb2
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--spec/support/builders.rb4
11 files changed, 16 insertions, 32 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 3a9654b77d..30832686b7 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -66,22 +66,6 @@ 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.
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 70dded01ba..718b92acd3 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -129,7 +129,7 @@ module Bundler
end
def guard_clean
- clean? && committed? or raise("There are files that need to be committed first.")
+ clean? && committed? || raise("There are files that need to be committed first.")
end
def clean?
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index c8c61497ef..c5556da067 100644
--- a/lib/bundler/graph.rb
+++ b/lib/bundler/graph.rb
@@ -97,8 +97,8 @@ module Bundler
Gem::Dependency.class_eval do
def matching_specs(platform_only = false)
matches = Bundler.load.specs.select { |spec|
- name == spec.name and
- requirement.satisfied_by? spec.version
+ name == spec.name &&
+ requirement.satisfied_by?(spec.version)
}
if platform_only
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index f0efbc448f..8d4a114ede 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -19,7 +19,7 @@ module Bundler
end
def full_name
- if platform == Gem::Platform::RUBY or platform.nil?
+ if platform == Gem::Platform::RUBY || platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
@@ -35,7 +35,7 @@ module Bundler
end
def to_lock
- if platform == Gem::Platform::RUBY or platform.nil?
+ if platform == Gem::Platform::RUBY || platform.nil?
out = " #{name} (#{version})\n"
else
out = " #{name} (#{version}-#{platform})\n"
diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb
index 1dda3cadc1..f1d95bfb59 100644
--- a/lib/bundler/match_platform.rb
+++ b/lib/bundler/match_platform.rb
@@ -5,8 +5,8 @@ module Bundler
include GemHelpers
def match_platform(p)
- Gem::Platform::RUBY == platform or
- platform.nil? or p == platform or
+ Gem::Platform::RUBY == platform ||
+ platform.nil? || p == platform ||
generic(Gem::Platform.new(platform)) === p
end
end
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 3050c37371..c8247c4c95 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -27,7 +27,7 @@ module Bundler
end
def full_name
- if platform == Gem::Platform::RUBY or platform.nil?
+ if platform == Gem::Platform::RUBY || platform.nil?
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{platform}"
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index c9a9ea4f08..00d7e6d1df 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -312,7 +312,7 @@ module Bundler
def amount_constrained(dependency)
@amount_constrained ||= {}
@amount_constrained[dependency.name] ||= begin
- if base = @base[dependency.name] and !base.empty?
+ if (base = @base[dependency.name]) && !base.empty?
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
else
base_dep = Dependency.new dependency.name, ">= 0.a"
@@ -332,7 +332,7 @@ module Bundler
requirements.each do |requirement|
next if requirement.name == "bundler"
if search_for(requirement).empty?
- if base = @base[requirement.name] and !base.empty?
+ if (base = @base[requirement.name]) && !base.empty?
version = base.first.version
message = "You have requested:\n" \
" #{requirement.name} #{requirement.requirement}\n\n" \
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index b1f0984cc9..9d8d4f775f 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -354,7 +354,7 @@ module Bundler
if exec_name
spec = specs.find {|s| s.executables.include?(exec_name) }
- spec or raise Gem::Exception, "can't find executable #{exec_name}"
+ raise(Gem::Exception, "can't find executable #{exec_name}") unless spec
unless spec.name == name
warn "Bundler is using a binstub that was created for a different gem.\n" \
"This is deprecated, in future versions you may need to `bundle binstub #{name}` " \
@@ -362,7 +362,7 @@ module Bundler
end
else
spec = specs.find {|s| s.name == name }
- exec_name = spec.default_executable or raise Gem::Exception, "no default executable for #{spec.full_name}"
+ raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name = spec.default_executable
end
gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 4a1e3c92f9..8052bff3f9 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -21,7 +21,7 @@ module Bundler
raise GemNotFound, "#{spec.full_name} is missing. Run `bundle` to get it."
end
- if activated_spec = Bundler.rubygems.loaded_specs(spec.name) and activated_spec.version != spec.version
+ if (activated_spec = Bundler.rubygems.loaded_specs(spec.name)) && activated_spec.version != spec.version
e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
"but your Gemfile requires #{spec.name} #{spec.version}. Prepending " \
"`bundle exec` to your command may solve this."
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index c859a7677b..6660a737bc 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -29,7 +29,7 @@ module Bundler
end
def []=(key, value)
- local_config_file or raise GemfileNotFound, "Could not locate Gemfile"
+ local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
set_key(key, value, @local_config, local_config_file)
end
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 913263c51d..0db32aa3b6 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -408,7 +408,7 @@ module Spec
Array(versions).each do |version|
spec = builder.new(self, name, version)
- if !spec.authors or spec.authors.empty?
+ if !spec.authors || spec.authors.empty?
spec.authors = ["no one"]
end
yield spec if block_given?
@@ -666,7 +666,7 @@ module Spec
destination = opts[:path] || _default_path
FileUtils.mkdir_p(destination)
- if !@spec.authors or @spec.authors.empty?
+ if !@spec.authors || @spec.authors.empty?
@spec.authors = ["that guy"]
end