Finding project files containing console.log()
Found this little snippet online and modified for my own purposes. The goal was to find all template and PHP files containing console.log() operations, left in by other developers and programmers for debugging purposes. You don't want to have these files in your production environment, therefore before committing your code you could (with little modifications) add this to your pre-commit git hook and refuse commit if certain files contain console.log().
Following command will find all PHP, PHTML and TPL files in current folder which contain string console.log(
It will simply list all the files. You could pipe it with " | wc -l" to get counts.
egrep -lir --include=*.{php,phtml,tpl} "(console\.log\()" .
Following command will find all PHP, PHTML and TPL files in current folder which contain string console.log(
It will simply list all the files. You could pipe it with " | wc -l" to get counts.
Comments
Post a Comment