From eb08215e87406127dca71769152c31872518a8b0 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Fri, 20 Jan 2017 08:38:01 -0800 Subject: [PATCH] Fix warnings reported by latest RuboCop (0.47) --- .rubocop.yml | 4 ++++ lib/capistrano/configuration/servers.rb | 2 ++ lib/capistrano/dsl.rb | 2 ++ 3 files changed, 8 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index d977021f..ccb63935 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,6 +3,10 @@ AllCops: DisplayStyleGuide: true TargetRubyVersion: 2.0 +Metrics/BlockLength: + Exclude: + - "spec/**/*" + - "lib/**/*.rake" Style/BarePercentLiterals: EnforcedStyle: percent_q Style/ClassAndModuleChildren: diff --git a/lib/capistrano/configuration/servers.rb b/lib/capistrano/configuration/servers.rb index 36d14d47..c816c6a2 100644 --- a/lib/capistrano/configuration/servers.rb +++ b/lib/capistrano/configuration/servers.rb @@ -17,10 +17,12 @@ module Capistrano end end + # rubocop:disable Security/MarshalLoad def add_role(role, hosts, options={}) options_deepcopy = Marshal.dump(options.merge(roles: role)) Array(hosts).each { |host| add_host(host, Marshal.load(options_deepcopy)) } end + # rubocop:enable Security/MarshalLoad def roles_for(names) options = extract_options(names) diff --git a/lib/capistrano/dsl.rb b/lib/capistrano/dsl.rb index 6317f7e5..d7519dd6 100644 --- a/lib/capistrano/dsl.rb +++ b/lib/capistrano/dsl.rb @@ -59,10 +59,12 @@ module Capistrano VersionValidator.new(locked_version).verify end + # rubocop:disable Security/MarshalLoad def on(hosts, options={}, &block) subset_copy = Marshal.dump(Configuration.env.filter(hosts)) SSHKit::Coordinator.new(Marshal.load(subset_copy)).each(options, &block) end + # rubocop:enable Security/MarshalLoad def run_locally(&block) SSHKit::Backend::Local.new(&block).run