module Hoe::Deveiate
def define_whitespace_checker_tasks
def define_whitespace_checker_tasks desc "Check source code for inconsistent whitespace" task :check_whitespace => [ :check_for_trailing_whitespace, :check_for_mixed_indentation, ] desc "Check source code for trailing whitespace" task :check_for_trailing_whitespace do lines = find_matching_source_lines do |line, _| line =~ TRAILING_WHITESPACE_RE end unless lines.empty? desc = "Found some trailing whitespace" describe_lines_that_need_fixing( desc, lines, TRAILING_WHITESPACE_RE ) fail end end desc "Check source code for mixed indentation" task :check_for_mixed_indentation do lines = find_matching_source_lines do |line, _| line =~ /(?<!#)([ ]\t)/ end unless lines.empty? desc = "Found mixed indentation" describe_lines_that_need_fixing( desc, lines, /[ ]\t/ ) fail end end end