Giuseppe Lavagetto has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/382716 )

Change subject: Rakefile: tweak wmf_style output for Jenkins
......................................................................


Rakefile: tweak wmf_style output for Jenkins

Adjust puppet-lint output when running global:wmf_style under CI.

The aim is to run a job on an hourly basis that would report the
progress of wmf_style fixes.  The Jenkins plugin that interprets
puppet-lint output expects a specific format.

Let print_wmf_style_violations accepts a report format.
Switch to use format() instead of #{hash[:key]}.

Set a specific format when JENKINS_URL is set.

Change-Id: I3107ba3fd52ec56eefeb670234cc62c22dbb41fe
---
M Rakefile
M rake_modules/taskgen.rb
2 files changed, 9 insertions(+), 3 deletions(-)

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



diff --git a/Rakefile b/Rakefile
index 8a24293..9799c49 100644
--- a/Rakefile
+++ b/Rakefile
@@ -92,7 +92,13 @@
     FileList[pattern].to_a.each do |puppet_file|
       linter.file = puppet_file
       linter.run
-      t.print_wmf_style_violations linter.problems unless 
linter.problems.empty?
+      next if linter.problems.empty?
+
+      if ENV.key?('JENKINS_URL')
+          t.print_wmf_style_violations linter.problems, nil, 
'%{path}:%{line}:%{check}:%{kind}:%{message}'
+      else
+          t.print_wmf_style_violations linter.problems
+      end
     end
   end
 end
diff --git a/rake_modules/taskgen.rb b/rake_modules/taskgen.rb
index 1e4cf7a..9cfa592 100644
--- a/rake_modules/taskgen.rb
+++ b/rake_modules/taskgen.rb
@@ -41,14 +41,14 @@
     end
   end
 
-  def print_wmf_style_violations(problems, other=nil)
+  def print_wmf_style_violations(problems, other=nil, format='%{path}:%{line} 
%{message}')
     # Prints the wmf style violations
     other ||= {}
     events = problems.select do |p|
       other.select { |x| x[:message] == p[:message] && x[:path] == p[:path] 
}.empty?
     end
     events.each do |p|
-      puts "#{p[:path]}:#{p[:line]} #{p[:message]}"
+      puts format(format, p)
     end
     puts "Nothing found" if events.length.zero?
   end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3107ba3fd52ec56eefeb670234cc62c22dbb41fe
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to