Skip to content

Instantly share code, notes, and snippets.

@kerryb
Created October 13, 2010 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerryb/623813 to your computer and use it in GitHub Desktop.
Save kerryb/623813 to your computer and use it in GitHub Desktop.
namespace :code do
task :trailing_spaces do
grep "app", "spec"
end
def grep *file_patterns
files_found = ""
file_patterns.each do |file_pattern|
files_found << `grep -r -E '^.*[[:space:]]+$' --include '*.rb' #{file_pattern}`
end
abort("trailing spaces found:\n#{files_found}") unless files_found.empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment