diff options
author | Andre Arko <andre@arko.net> | 2015-07-18 16:47:28 -0600 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-07-18 16:47:28 -0600 |
commit | 77c9dd8fbe602c05040d7f2df3ff7decb08eb53e (patch) | |
tree | 97ba081c3cd569ba2f6227df8dd9cbfbe114191f | |
parent | 0f8bc78180ce4f8bae5dc48e2078b44cd4fafe44 (diff) | |
download | bundler-77c9dd8fbe602c05040d7f2df3ff7decb08eb53e.tar.gz |
Fix Style/SpaceAroundOperators
closes #3854
-rw-r--r-- | .rubocop_todo.yml | 6 | ||||
-rw-r--r-- | bundler.gemspec | 2 | ||||
-rw-r--r-- | lib/bundler.rb | 34 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 2 | ||||
-rw-r--r-- | lib/bundler/definition.rb | 4 | ||||
-rw-r--r-- | lib/bundler/dsl.rb | 6 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer/parallel_installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/ruby_version.rb | 6 | ||||
-rw-r--r-- | lib/bundler/similarity_detector.rb | 14 | ||||
-rw-r--r-- | lib/bundler/source/git.rb | 7 | ||||
-rw-r--r-- | spec/commands/update_spec.rb | 4 | ||||
-rw-r--r-- | spec/runtime/inline_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/helpers.rb | 8 |
14 files changed, 44 insertions, 55 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index eeff964d4b..f103f871d0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -427,12 +427,6 @@ Style/SingleSpaceBeforeFirstArg: Style/SpaceAfterComma: Enabled: false -# Offense count: 55 -# Cop supports --auto-correct. -# Configuration parameters: MultiSpaceAllowedForOperators. -Style/SpaceAroundOperators: - Enabled: false - # Offense count: 4 # Cop supports --auto-correct. Style/SpaceInsideStringInterpolation: diff --git a/bundler.gemspec b/bundler.gemspec index 3f069b9000..1e5198adb0 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) } # we don't check in man pages, but we need to ship them because # we use them to generate the long-form help for each command. - s.files += Dir.glob("lib/bundler/man/**/*") + s.files += Dir.glob("lib/bundler/man/**/*") s.bindir = "exe" s.executables = %w(bundle bundler) diff --git a/lib/bundler.rb b/lib/bundler.rb index 53fc98e0ab..3212a47e60 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -53,26 +53,26 @@ module Bundler end end - class GemfileNotFound < BundlerError; status_code(10); end - class GemNotFound < BundlerError; status_code(7); end - class GemfileError < BundlerError; status_code(4); end - class InstallError < BundlerError; status_code(5); end - class InstallHookError < BundlerError; status_code(8); end - class PathError < BundlerError; status_code(13); end - class GitError < BundlerError; status_code(11); end - class DeprecatedError < BundlerError; status_code(12); end - class GemspecError < BundlerError; status_code(14); end - class InvalidOption < BundlerError; status_code(15); end - class ProductionError < BundlerError; status_code(16); end - class HTTPError < BundlerError; status_code(17); end - class RubyVersionMismatch < BundlerError; status_code(18); end - class SecurityError < BundlerError; status_code(19); end - class LockfileError < BundlerError; status_code(20); end + class GemfileNotFound < BundlerError; status_code(10); end + class GemNotFound < BundlerError; status_code(7); end + class GemfileError < BundlerError; status_code(4); end + class InstallError < BundlerError; status_code(5); end + class InstallHookError < BundlerError; status_code(8); end + class PathError < BundlerError; status_code(13); end + class GitError < BundlerError; status_code(11); end + class DeprecatedError < BundlerError; status_code(12); end + class GemspecError < BundlerError; status_code(14); end + class InvalidOption < BundlerError; status_code(15); end + class ProductionError < BundlerError; status_code(16); end + class HTTPError < BundlerError; status_code(17); end + class RubyVersionMismatch < BundlerError; status_code(18); end + class SecurityError < BundlerError; status_code(19); end + class LockfileError < BundlerError; status_code(20); end class CyclicDependencyError < BundlerError; status_code(21); end - class GemfileLockNotFound < BundlerError; status_code(22); end + class GemfileLockNotFound < BundlerError; status_code(22); end # Internal errors, should be rescued - class VersionConflict < BundlerError + class VersionConflict < BundlerError attr_reader :conflicts def initialize(conflicts, msg = nil) diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index f4b1880aa9..2245f9585a 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -85,7 +85,7 @@ module Bundler Bundler.settings[:path] = nil if options[:system] Bundler.settings[:path] = "vendor/bundle" if options[:deployment] Bundler.settings[:path] = options["path"] if options["path"] - Bundler.settings[:path] ||= "bundle" if options["standalone"] + Bundler.settings[:path] ||= "bundle" if options["standalone"] Bundler.settings[:bin] = options["binstubs"] if options["binstubs"] Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty? Bundler.settings[:shebang] = options["shebang"] if options["shebang"] diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 37cc4d9de9..7ebad15eec 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -376,9 +376,9 @@ module Bundler end end - msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any? + msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any? msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any? - msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any? + msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any? msg << "\n" raise ProductionError, msg if added.any? || deleted.any? || changed.any? diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 0d0255ac99..7928dcaa4b 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -302,8 +302,8 @@ module Bundler end end - opts["source"] ||= @source - opts["env"] ||= @env + opts["source"] ||= @source + opts["env"] ||= @env opts["platforms"] = platforms.dup opts["group"] = groups opts["should_include"] = install_if @@ -321,7 +321,7 @@ module Bundler def validate_keys(command, opts, valid_keys) invalid_keys = opts.keys - valid_keys if invalid_keys.any? - message = "You passed #{invalid_keys.map {|k| ":"+k }.join(", ")} " + message = "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " message << if invalid_keys.size > 1 "as options for #{command}, but they are invalid." else diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 3295fc840d..3c9e547747 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -176,7 +176,7 @@ module Bundler # installation is just SO MUCH FASTER. so we let people opt in. def install(options) force = options["force"] - jobs = [Bundler.settings[:jobs].to_i-1, 1].max + jobs = [Bundler.settings[:jobs].to_i - 1, 1].max if jobs > 1 && can_install_in_parallel? require "bundler/installer/parallel_installer" install_in_parallel jobs, options[:standalone], force diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index fdc1ece76b..b962563a57 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -55,7 +55,7 @@ class ParallelInstaller # Returns max number of threads machine can handle with a min of 1 def self.max_threads - [Bundler.settings[:jobs].to_i-1, 1].max + [Bundler.settings[:jobs].to_i - 1, 1].max end def initialize(installer, all_specs, size, standalone, force) diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb index 64b2742df9..138262e3db 100644 --- a/lib/bundler/ruby_version.rb +++ b/lib/bundler/ruby_version.rb @@ -32,10 +32,10 @@ module Bundler end def ==(other) - version == other.version && - engine == other.engine && + version == other.version && + engine == other.engine && engine_version == other.engine_version && - patchlevel == other.patchlevel + patchlevel == other.patchlevel end # Returns a tuple of these things: diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index dc770c4281..2b90b266b4 100644 --- a/lib/bundler/similarity_detector.rb +++ b/lib/bundler/similarity_detector.rb @@ -10,16 +10,16 @@ module Bundler # return an array of words similar to 'word' from the corpus def similar_words(word, limit = 3) words_by_similarity = @corpus.map {|w| SimilarityScore.new(w, levenshtein_distance(word, w)) } - words_by_similarity.select {|s| s.distance<=limit }.sort_by(&:distance).map(&:string) + words_by_similarity.select {|s| s.distance <= limit }.sort_by(&:distance).map(&:string) end # return the result of 'similar_words', concatenated into a list # (eg "a, b, or c") def similar_word_list(word, limit = 3) words = similar_words(word,limit) - if words.length==1 + if words.length == 1 words[0] - elsif words.length>1 + elsif words.length > 1 [words[0..-2].join(", "), words[-1]].join(" or ") end end @@ -47,10 +47,10 @@ module Bundler for j in 1..this.length # critical comparison dm[i][j] = [ - dm[i-1][j-1] + - (this[j-1] == that[i-1] ? 0 : sub), - dm[i][j-1] + ins, - dm[i-1][j] + del + dm[i - 1][j - 1] + + (this[j - 1] == that[i - 1] ? 0 : sub), + dm[i][j - 1] + ins, + dm[i - 1][j] + del ].min end end diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 400b0a650b..4fcbd890fd 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -50,12 +50,7 @@ module Bundler end def eql?(o) - o.is_a?(Git) && - uri == o.uri && - ref == o.ref && - branch == o.branch && - name == o.name && - version == o.version && + o.is_a?(Git) && uri == o.uri && ref == o.ref && branch == o.branch && name == o.name && version == o.version && submodules == o.submodules end diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index bcef27ad5b..76a85a79ec 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -58,11 +58,11 @@ describe "bundle update" do describe "with an unknown dependency" do it "should inform the user" do - bundle "update halting-problem-solver", :expect_err =>true + bundle "update halting-problem-solver", :expect_err => true expect(out).to include "Could not find gem 'halting-problem-solver'" end it "should suggest alternatives" do - bundle "update active-support", :expect_err =>true + bundle "update active-support", :expect_err => true expect(out).to include "Did you mean activesupport?" end end diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 73ced322e3..2e33cf9c9f 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" describe "bundler/inline#gemfile" do def script(code, options = {}) requires = ["bundler/inline"] - requires.unshift File.expand_path("../../support/artifice/"+options.delete(:artifice)+".rb", __FILE__) if options.key?(:artifice) + requires.unshift File.expand_path("../../support/artifice/" + options.delete(:artifice) + ".rb", __FILE__) if options.key?(:artifice) requires = requires.map {|r| "require '#{r}'" }.join("\n") @out = ruby("#{requires}\n\n" << code, options) end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 6014764d82..fc9dc72509 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -64,8 +64,8 @@ module Spec bundle_bin = File.expand_path("../../../exe/bundle", __FILE__) requires = options.delete(:requires) || [] - requires << File.expand_path("../fakeweb/"+options.delete(:fakeweb)+".rb", __FILE__) if options.key?(:fakeweb) - requires << File.expand_path("../artifice/"+options.delete(:artifice)+".rb", __FILE__) if options.key?(:artifice) + requires << File.expand_path("../fakeweb/" + options.delete(:fakeweb) + ".rb", __FILE__) if options.key?(:fakeweb) + requires << File.expand_path("../artifice/" + options.delete(:artifice) + ".rb", __FILE__) if options.key?(:artifice) requires_str = requires.map {|r| "-r#{r}" }.join(" ") env = (options.delete(:env) || {}).map {|k, v| "#{k}='#{v}'" }.join(" ") @@ -84,8 +84,8 @@ module Spec bundle_bin = File.expand_path("../../../exe/bundle_ruby", __FILE__) requires = options.delete(:requires) || [] - requires << File.expand_path("../fakeweb/"+options.delete(:fakeweb)+".rb", __FILE__) if options.key?(:fakeweb) - requires << File.expand_path("../artifice/"+options.delete(:artifice)+".rb", __FILE__) if options.key?(:artifice) + requires << File.expand_path("../fakeweb/" + options.delete(:fakeweb) + ".rb", __FILE__) if options.key?(:fakeweb) + requires << File.expand_path("../artifice/" + options.delete(:artifice) + ".rb", __FILE__) if options.key?(:artifice) requires_str = requires.map {|r| "-r#{r}" }.join(" ") env = (options.delete(:env) || {}).map {|k, v| "#{k}='#{v}' " }.join |