summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWild Kat <wk@futureinquestion.net>2018-04-25 18:43:23 +0200
committerWild Kat <wk@futureinquestion.net>2018-04-25 18:43:23 +0200
commit5e31f4bc028f0e0bd6aade771fe10a3cc6d2a5fa (patch)
treeb2d4c975731c8c5edb1940096e6676ca93ba672d
parent60c3408bfc0f6aa5a89013f99e0763719440f29b (diff)
fine tune rubocop to yttis exacting specifications
-rw-r--r--.rubocop.yml11
-rw-r--r--lib/oxidized/hook/slackdiff.rb2
-rw-r--r--oxidized.gemspec2
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'