Skip to content

Instantly share code, notes, and snippets.

@Sharpie
Last active August 29, 2015 14:00
Show Gist options
  • Save Sharpie/11277458 to your computer and use it in GitHub Desktop.
Save Sharpie/11277458 to your computer and use it in GitHub Desktop.
A simple YARD linter that prints out the names of files with issues
#!/usr/bin/env ruby
require 'open3'
stdout, stderr, status = Open3.capture3 'inch'
lint = {}
FILE_REGEX = /\[debug\]: (Parsing|Re-processing) ([^[:blank:]]*\.rb)[\.]*$/
current_file = nil
stdout.each_line do |line|
if ( match = FILE_REGEX.match(line) )
current_file = match.captures[1]
lint[current_file] ||= []
else
lint[current_file] << line unless current_file.nil?
end
end
lint.reject!{|_, v| v.empty?}
lint.keys.sort.each do |key|
puts key
lint[key].each {|l| puts "\t" + l }
puts "\n"
end
puts "Total Files With Issues: #{lint.length}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment