Zero tolerance
• Julian Simpson
This has been surprisingly useful at keeping my JS code clean.
desc "Check for tabs and trailing spaces" task :crapcheck do Dir["public/**/*.js"].each do |f| next if f.match(/^lib|resources/) text = File.read(f) raise "Tabs found in #{f}" if text.match(/t/) raise "Trailing spaces found in #{f}" if text.match(/ $| $/) end end
The tab check is useful because I hate them, and they mess with JSLint; the trailing spaces mess up my diffs. Take that.