Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(check:trailing_whitespace): collect all problems, report and then exit #141

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/voxpupuli/test/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@
namespace :check do
desc 'Check for trailing whitespace'
task :trailing_whitespace do
errors = []

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
errors << "#{filename} has trailing whitespace on line #{index + 1}"
end
end
end

if errors.any?
errors.each { |error| puts error }
exit 1
end
end
end

Rake::Task[:check].enhance ['check:trailing_whitespace']
Loading