modified version of jenkins debian glue (https://github.com/mika/jenkins-debian-glue) for devuan
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
1.0 KiB

  1. #!/usr/bin/env ruby
  2. if ARGV[0].nil?
  3. $stderr.puts "Usage: #{File.basename $0} <file>"
  4. exit 1
  5. end
  6. if not system "which perlcritic >/dev/null 2>&1"
  7. $stderr.puts "Error: program perlcritic does not exist (install libperl-critic-perl?)."
  8. exit 1
  9. end
  10. # not sure whether we really should check this here..
  11. #if !File.exists?('/usr/share/perl5/Test/Log4perl.pm')
  12. # $stderr.puts "Error: libtest-log4perl-perl not installed."
  13. # exit 1
  14. #end
  15. file = ARGV[0]
  16. # make sure we're checking a perl script
  17. mimetype = `file -b --keep-going #{file}`.gsub(/\n/,"")
  18. if not /.*perl/i.match(mimetype)
  19. $stderr.puts "File #{file} doesn't look like perl [#{mimetype}]. Ignoring."
  20. exit 0
  21. end
  22. # let's see what perlcritic thinks...
  23. output = %x{perlcritic #{file}}
  24. num_lines = output.lines.count
  25. counter = 1
  26. # output result in TAP format
  27. puts "1..#{num_lines}"
  28. output.each_line do |critic|
  29. if critic =~ /.* source OK$/
  30. puts "ok #{counter} #{critic}"
  31. else
  32. puts "not ok #{counter} #{critic}"
  33. end
  34. counter += 1
  35. end