[MediaWiki-commits] [Gerrit] operations...wmf_styleguide-check[master]: Use the hiera() value in the message

2017-10-24 Thread Giuseppe Lavagetto (Code Review)
Giuseppe Lavagetto has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/386110 )

Change subject: Use the hiera() value in the message
..


Use the hiera() value in the message

* When reporting invalid hiera calls, add the value of the hiera call to
  the message to make messages unique, so that they can be easily
  distinguished when comparing previous and current linter violations.

Change-Id: Ia59fe90a11ed55576d7564a9c6a9dd417a7e1372
---
M lib/puppet-lint/plugins/check_wmf_styleguide.rb
M spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
2 files changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/puppet-lint/plugins/check_wmf_styleguide.rb 
b/lib/puppet-lint/plugins/check_wmf_styleguide.rb
index 1bd9e58..11a2529 100644
--- a/lib/puppet-lint/plugins/check_wmf_styleguide.rb
+++ b/lib/puppet-lint/plugins/check_wmf_styleguide.rb
@@ -217,8 +217,9 @@
 
 def hiera_errors(tokens, klass)
   tokens.each do |token|
+value = token.next_code_token.next_code_token.value
 msg = {
-  message: "wmf-style: Found hiera call in #{klass.type} '#{klass.name}'",
+  message: "wmf-style: Found hiera call in #{klass.type} '#{klass.name}' 
for '#{value}'",
   line: token.line,
   column: token.column
 }
diff --git a/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb 
b/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
index 3580c71..bc39f21 100644
--- a/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
+++ b/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
@@ -12,7 +12,7 @@
 
 class_ko = <<-EOF
 class foo($t=hiera('foo::title')) {
-   $msg = hiera("foo::bar")
+   $msg = hiera( "foo::bar")
notice($msg)
notice($t)
include ::passwords::redis
@@ -88,9 +88,8 @@
   context 'class with errors' do
 let(:code) { class_ko }
 it 'should create errors for hiera declarations' do
-  hiera_msg = "wmf-style: Found hiera call in class 'foo'"
-  expect(problems).to contain_error(hiera_msg).on_line(1).in_column(14)
-  expect(problems).to contain_error(hiera_msg).on_line(2).in_column(15)
+  expect(problems).to contain_error("wmf-style: Found hiera call in class 
'foo' for 'foo::title'").on_line(1).in_column(14)
+  expect(problems).to contain_error("wmf-style: Found hiera call in class 
'foo' for 'foo::bar'").on_line(2).in_column(15)
 end
 it 'should create errors for included classes' do
   expect(problems).to contain_error("wmf-style: class 'foo' includes 
passwords::redis from another module").on_line(5).in_column(16)
@@ -104,7 +103,7 @@
   expect(problems).to contain_error("wmf-style: Parameter 'test' of class 
'profile::fixme' has no call to hiera").on_line(2).in_column(7)
 end
 it 'should create errors for hiera calls in body' do
-  expect(problems).to contain_error("wmf-style: Found hiera call in class 
'profile::fixme'").on_line(5).in_column(13)
+  expect(problems).to contain_error("wmf-style: Found hiera call in class 
'profile::fixme' for 'role'").on_line(5).in_column(13)
 end
 it 'should create errors for use of system::role' do
   expect(problems).to contain_error("wmf-style: class 'profile::fixme' 
declares system::role, which should only be used in 
roles").on_line(6).in_column(5)

-- 
To view, visit https://gerrit.wikimedia.org/r/386110
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia59fe90a11ed55576d7564a9c6a9dd417a7e1372
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet-lint/wmf_styleguide-check
Gerrit-Branch: master
Gerrit-Owner: Volans 
Gerrit-Reviewer: Giuseppe Lavagetto 
Gerrit-Reviewer: Herron 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations...wmf_styleguide-check[master]: Use the hiera() value in the message

2017-10-23 Thread Volans (Code Review)
Volans has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386110 )

Change subject: Use the hiera() value in the message
..

Use the hiera() value in the message

* When reporting invalid hiera calls, add the value of the hiera call to
  the message to make messages unique, so that they can be easily
  distinguished when comparing previous and current linter violations.

Change-Id: Ia59fe90a11ed55576d7564a9c6a9dd417a7e1372
---
M lib/puppet-lint/plugins/check_wmf_styleguide.rb
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/puppet-lint/wmf_styleguide-check 
refs/changes/10/386110/1

diff --git a/lib/puppet-lint/plugins/check_wmf_styleguide.rb 
b/lib/puppet-lint/plugins/check_wmf_styleguide.rb
index 1bd9e58..d28cbfa 100644
--- a/lib/puppet-lint/plugins/check_wmf_styleguide.rb
+++ b/lib/puppet-lint/plugins/check_wmf_styleguide.rb
@@ -218,7 +218,7 @@
 def hiera_errors(tokens, klass)
   tokens.each do |token|
 msg = {
-  message: "wmf-style: Found hiera call in #{klass.type} '#{klass.name}'",
+  message: "wmf-style: Found hiera call in #{klass.type} '#{klass.name}' 
for '#{token.next_token.next_token.value}'",
   line: token.line,
   column: token.column
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/386110
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia59fe90a11ed55576d7564a9c6a9dd417a7e1372
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet-lint/wmf_styleguide-check
Gerrit-Branch: master
Gerrit-Owner: Volans 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits