summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2018-04-25 20:34:10 +0300
committerGitHub <noreply@github.com>2018-04-25 20:34:10 +0300
commit96910082ed914ee51f33eaea44dd34f8bf5d11e6 (patch)
tree63a6229522ad72888b6bbe505786daf7a93558ab
parent60c3408bfc0f6aa5a89013f99e0763719440f29b (diff)
parent75765bedae8a8511260d43ec7f46edc994899c7c (diff)
Merge pull request #1308 from wk/restore-compliance
fine tune rubocop to yttis exacting specifications
-rw-r--r--.rubocop.yml11
-rw-r--r--.rubocop_todo.yml23
-rw-r--r--lib/oxidized/hook/slackdiff.rb2
-rw-r--r--oxidized.gemspec2
-rw-r--r--spec/cli_spec.rb2
5 files changed, 17 insertions, 23 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index bc013cd..60b4e11 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/.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:
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'
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