I am looking for a ruby code quality checker that could catch or notify if something like a ‘debugger’ statement gets accidentally committed to ruby code. It would also be ideal if it could look in a rails project and scan any places that may contain ruby code like a haml file.
The idea would be that this would be run with cruisecontrol.rb and against a code base where there are holes in test coverage.
Don’t over-think it! Just write a simple script to search for it over your app’s directory.
Using command-line
grep:Using
ack:Using Ruby’s
grep:(Ruby code lovingly adapted from _why’s Wearing Ruby Slippers to Work)
You might also want to consider searching over Javascript files for
"debugger"as well, and possibly"console.log", etc.You may also want to make this be more strict to reduce false positives by using something like
/^\s*debugger\s*$/to only match it when it’s the only thing on the line. Adapting this to work for HAML probably requires a bit more:/^\s*[-=]\s*debugger\s*$/.