Sha256: f20d5e17e4dc43c06d263a1773d4eea2f30fc3e49bba9445d0933b4bae05a66e
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module RakeCommandFilter # default way to run rubocop and parse its output class YardCommandDefinition < RakeCommandDefinition attr_accessor :threshold # for testing def self.percent_msg(percent) "#{percent} documented" end # for testing def self.warning_msg 'One or more yard warnings, see above' end # Default parser for yard output. # @param threshold override this if you want to require less than 95% documentation # @param id override this if you want to do something other than 'rake spec' def initialize(threshold = 95, id = :yard) super(id, 'yard') # just use sensible defaults here. add_filter(:yard_percentage, /(\d+.?\d+)%\s+document/) do |matches| percent = matches[0].to_f msg = YardCommandDefinition.percent_msg(percent) (percent >= threshold) ? result_success(msg) : result_failure(msg) end add_filter(:yard_warning, /\[warn\]:(.*)/) do |_matches| result_warning(YardCommandDefinition.warning_msg) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rake_command_filter-0.1.2 | lib/yard_command_definition.rb |
rake_command_filter-0.1.0 | lib/yard_command_definition.rb |