diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2015-11-26 12:44:47 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2015-11-26 12:44:47 -0600 |
commit | 3825d06ca25a349832c0b2fd1ede22dc3fb9344d (patch) | |
tree | a9e48c57df0fd9b0cdc2aed891deabf403de950c | |
parent | 232815d8d5d8549a9f1c51c74872a89741f96911 (diff) | |
download | bundler-3825d06ca25a349832c0b2fd1ede22dc3fb9344d.tar.gz |
[RuboCop] Enable Style/ParallelAssignment
-rw-r--r-- | .rubocop_todo.yml | 10 | ||||
-rw-r--r-- | lib/bundler/dsl.rb | 3 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 3 | ||||
-rw-r--r-- | lib/bundler/ui/shell.rb | 3 | ||||
-rw-r--r-- | spec/bundler/bundler_spec.rb | 15 | ||||
-rw-r--r-- | spec/support/helpers.rb | 15 |
6 files changed, 26 insertions, 23 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f62ec4c11f..22c7e42108 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -113,16 +113,6 @@ Style/MultilineBlockChain: Exclude: - 'spec/support/less_than_proc.rb' -# Offense count: 13 -# Cop supports --auto-correct. -Style/ParallelAssignment: - Exclude: - - 'lib/bundler/dsl.rb' - - 'lib/bundler/shared_helpers.rb' - - 'lib/bundler/ui/shell.rb' - - 'spec/bundler/bundler_spec.rb' - - 'spec/support/helpers.rb' - # Offense count: 8 # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. Style/PredicateName: diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index d4b1883d5d..efb1350c6f 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -205,7 +205,8 @@ module Bundler alias_method :platform, :platforms def env(name) - @env, old = name, @env + old = @env + @env = name yield ensure @env = old diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 2e57accb8e..2e512bfc74 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -151,7 +151,8 @@ module Bundler filename = File.join(current, name) yield filename end - current, previous = File.expand_path("..", current), current + previous = current + current = File.expand_path("..", current) end end diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb index 65460f2fdb..2c0076dc06 100644 --- a/lib/bundler/ui/shell.rb +++ b/lib/bundler/ui/shell.rb @@ -75,7 +75,8 @@ module Bundler end def silence - old_level, @level = @level, "silent" + old_level = @level + @level = "silent" yield ensure @level = old_level diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb index 1cdfc6d30f..1b0addadb5 100644 --- a/spec/bundler/bundler_spec.rb +++ b/spec/bundler/bundler_spec.rb @@ -24,7 +24,8 @@ describe Bundler do context "on Rubies with a settable YAML engine", :if => defined?(YAML::ENGINE) do context "with Syck as YAML::Engine" do it "raises a GemspecError after YAML load throws ArgumentError" do - orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, "syck" + orig_yamler = YAML::ENGINE.yamler + YAML::ENGINE.yamler = "syck" expect { subject }.to raise_error(Bundler::GemspecError) @@ -34,7 +35,8 @@ describe Bundler do context "with Psych as YAML::Engine" do it "raises a GemspecError after YAML load throws Psych::SyntaxError" do - orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, "psych" + orig_yamler = YAML::ENGINE.yamler + YAML::ENGINE.yamler = "psych" expect { subject }.to raise_error(Bundler::GemspecError) @@ -48,8 +50,10 @@ describe Bundler do it "can load a gemspec with unicode characters with default ruby encoding" do # spec_helper forces the external encoding to UTF-8 but that's not the # default until Ruby 2.0 - verbose, $VERBOSE = $VERBOSE, false - encoding, Encoding.default_external = Encoding.default_external, "ASCII" + verbose = $VERBOSE + $VERBOSE = false + encoding = Encoding.default_external + Encoding.default_external = "ASCII" $VERBOSE = verbose File.open(app_gemspec_path, "wb") do |file| @@ -63,7 +67,8 @@ describe Bundler do expect(subject.author).to eq("André the Giant") - verbose, $VERBOSE = $VERBOSE, false + verbose = $VERBOSE + $VERBOSE = false Encoding.default_external = encoding $VERBOSE = verbose end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 3bf4ce56d4..70e58e574f 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -124,7 +124,8 @@ module Spec def gembin(cmd) lib = File.expand_path("../../../lib", __FILE__) - old, ENV["RUBYOPT"] = ENV["RUBYOPT"], "#{ENV["RUBYOPT"]} -I#{lib}" + old = ENV["RUBYOPT"] + ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{lib}" cmd = bundled_app("bin/#{cmd}") unless cmd.to_s.include?("/") sys_exec(cmd.to_s) ensure @@ -324,7 +325,8 @@ module Spec end def simulate_platform(platform) - old, ENV["BUNDLER_SPEC_PLATFORM"] = ENV["BUNDLER_SPEC_PLATFORM"], platform.to_s + old = ENV["BUNDLER_SPEC_PLATFORM"] + ENV["BUNDLER_SPEC_PLATFORM"] = platform.to_s yield if block_given? ensure ENV["BUNDLER_SPEC_PLATFORM"] = old if block_given? @@ -333,8 +335,10 @@ module Spec def simulate_ruby_engine(engine, version = "1.6.0") return if engine == local_ruby_engine - old, ENV["BUNDLER_SPEC_RUBY_ENGINE"] = ENV["BUNDLER_SPEC_RUBY_ENGINE"], engine - old_version, ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"], version + old = ENV["BUNDLER_SPEC_RUBY_ENGINE"] + ENV["BUNDLER_SPEC_RUBY_ENGINE"] = engine + old_version = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] + ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] = version yield if block_given? ensure ENV["BUNDLER_SPEC_RUBY_ENGINE"] = old if block_given? @@ -342,7 +346,8 @@ module Spec end def simulate_bundler_version(version) - old, ENV["BUNDLER_SPEC_VERSION"] = ENV["BUNDLER_SPEC_VERSION"], version.to_s + old = ENV["BUNDLER_SPEC_VERSION"] + ENV["BUNDLER_SPEC_VERSION"] = version.to_s yield if block_given? ensure ENV["BUNDLER_SPEC_VERSION"] = old if block_given? |