From 5e31f4bc028f0e0bd6aade771fe10a3cc6d2a5fa Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Wed, 25 Apr 2018 18:43:23 +0200 Subject: fine tune rubocop to yttis exacting specifications --- .rubocop.yml | 11 +++++++++++ lib/oxidized/hook/slackdiff.rb | 2 +- oxidized.gemspec | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index bc013cd..f43ca42 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,6 +17,17 @@ Style/PreferredHashMethods: Style/Not: Enabled: false +# comply with @ytti's exacting specifications +Style/CommandLiteral: + EnforcedStyle: percent_x + +Style/FormatString: + EnforcedStyle: percent + +Style/FormatStringToken: + EnforcedStyle: unannotated + +# Do not attempt to police vendored code, and exclude special cases AllCops: Exclude: - 'vendor/**/*' diff --git a/lib/oxidized/hook/slackdiff.rb b/lib/oxidized/hook/slackdiff.rb index 2c5ec14..baaf291 100644 --- a/lib/oxidized/hook/slackdiff.rb +++ b/lib/oxidized/hook/slackdiff.rb @@ -43,7 +43,7 @@ class SlackDiff < Oxidized::Hook # message custom formatted - optional if cfg.has_key?('message') == true log cfg.message - msg = format(cfg.message, :node => ctx.node.name.to_s, :group => ctx.node.group.to_s, :commitref => ctx.commitref, :model => ctx.node.model.class.name.to_s.downcase) + msg = cfg.message % { :node => ctx.node.name.to_s, :group => ctx.node.group.to_s, :commitref => ctx.commitref, :model => ctx.node.model.class.name.to_s.downcase } log msg log "Posting message to #{cfg.channel}" client.chat_postMessage(channel: cfg.channel, text: msg, as_user: true) diff --git a/oxidized.gemspec b/oxidized.gemspec index 06e1af9..bf90d00 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.summary = 'feeble attempt at rancid' s.description = 'software to fetch configuration from network devices and store them' s.rubyforge_project = s.name - s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + s.files = %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } s.executables = %w[oxidized] s.require_path = 'lib' -- cgit v1.2.1 From 8aa0cc45e50daa19b0418207ba4bcf5c0e664b7a Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Wed, 25 Apr 2018 18:48:34 +0200 Subject: regenerate .rubocop_todo.yml --- .rubocop.yml | 2 +- .rubocop_todo.yml | 23 +++-------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index f43ca42..60b4e11 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,7 +17,7 @@ Style/PreferredHashMethods: Style/Not: Enabled: false -# comply with @ytti's exacting specifications +# comply with @ytti's exacting specifications Style/CommandLiteral: EnforcedStyle: percent_x diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index db70e00..77c1026 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-04-25 15:40:14 +0200 using RuboCop version 0.55.0. +# on 2018-04-25 18:47:11 +0200 using RuboCop version 0.55.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -336,7 +336,7 @@ Style/ConditionalAssignment: - 'lib/oxidized/hook/githubrepo.rb' - 'lib/oxidized/model/model.rb' -# Offense count: 143 +# Offense count: 144 Style/Documentation: Enabled: false @@ -360,23 +360,6 @@ Style/ExpandPathArguments: Exclude: - 'bin/console' -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: format, sprintf, percent -Style/FormatString: - Exclude: - - 'lib/oxidized/node.rb' - - 'lib/oxidized/nodes.rb' - -# Offense count: 16 -# Configuration parameters: EnforcedStyle. -# SupportedStyles: annotated, template, unannotated -Style/FormatStringToken: - Exclude: - - 'lib/oxidized/node.rb' - - 'lib/oxidized/nodes.rb' - # Offense count: 13 # Configuration parameters: MinBodyLength. Style/GuardClause: @@ -441,7 +424,7 @@ Style/MultilineIfThen: Exclude: - 'lib/oxidized/model/aricentiss.rb' -# Offense count: 8 +# Offense count: 9 # Cop supports --auto-correct. Style/MutableConstant: Exclude: -- cgit v1.2.1 From 75765bedae8a8511260d43ec7f46edc994899c7c Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Wed, 25 Apr 2018 19:06:19 +0200 Subject: fix cli_spec.rb to reflect new version output --- spec/cli_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 4ceb8ed..8b9b792 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -21,7 +21,7 @@ describe Oxidized::CLI do File.expects(:expand_path) Kernel.expects(:exit) - assert_output("#{Oxidized::VERSION}\n") { Oxidized::CLI.new } + assert_output("#{Oxidized::VERSION_FULL}\n") { Oxidized::CLI.new } end end end -- cgit v1.2.1