The pre-commit file listed here is setup to scan files for invalid keywords prior to commit to avoid debug or logging information making its way into production files. Right now it is setup to scan only .js
and .coffee
files for the following keywords:
KEYWORDS_REGEX="console\.(debug|info|log|warn)\(|alert\(|debugger"
EXTENSIONS_REGEX="(.js$|.coffee$)"
cp pre-commit .git/hooks/
chmod +x .git/hooks/pre-commit
- modified from: https://github.com/borisguery/git-keywords-checker
Also take a look at git-hooks for managing hooks across repos (can be installed global, per user, or per repo). Useful to avoid copy/pasta hooks.