Skip to content

Commit

Permalink
(voxpupuliGH-151) Implement whitespace checks for markdown
Browse files Browse the repository at this point in the history
This implements a rake task check:trailing_whitespace. The actual check
has mostly been written by Garrett Honeycutt.

Co-authored-by: Garrett Honeycutt <code@garretthoneycutt.com>
  • Loading branch information
ekohl and ghoneycutt committed Jan 11, 2019
1 parent e0cba09 commit 917ada8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions moduleroot/Rakefile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ task test: [
<% end -%>
]
namespace :check do
desc 'Check for trailing whitespace'
task :trailing_whitespace do
Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename|
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}
File.foreach(filename).each_with_index do |line, index|
if line =~ %r{\s\n$}
puts "#{filename} has trailing whitespace on line #{index + 1}"
exit 1
end
end
end
end
end
Rake::Task[:release_checks].enhance ['check:trailing_whitespace']
desc "Run main 'test' task and report merged results to coveralls"
task test_with_coveralls: [:test] do
if Dir.exist?(File.expand_path('../lib', __FILE__))
Expand Down

0 comments on commit 917ada8

Please sign in to comment.