Advertisement
iarmin

Yamlint

Nov 4th, 2016
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.44 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'yaml'
  4. ARGV.each do |file|
  5.     if File.file? file
  6.         begin
  7.             YAML.load_file(file)
  8.             puts "#{file} OK"
  9.         rescue Exception => e
  10.             puts "#{file} #{e.message}"
  11.         end
  12.     end
  13. end
  14.  
  15. # save as /usr/local/bin/yamlint and make it executable
  16. # quick: wget http://pastebin.com/raw/dGpQanF3 -O- | tr -d '\r' > /usr/local/bin/yamlint  && chmod +x /usr/local/bin/yamlint
  17. # possible usage: find . -name '*.yml' | xargs yamlint
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement