We have a PHP 5 web application and we're currently evaluating PHP CodeSniffer in order to decide whether forcing code standards improves code quality.
We use subversion for our code repository and deployment base and I have added a SVN pre-commit hook to ensure all files committed are free from coding standard smells. The hook technically works but causes too many headaches to be actually useful:
- If we have to fix an emergency bug that is causing a site outage, the last thing we need is the commit to be denied due to some minor whitespace indentation issue.
- We have ALOT of legacy code that has sometimes hundreds of phpcs errors - it is not pragmatic to fix all the phpcs errors in these files right now. One example is a file full of functions that don't have doc comments. Another example is if a class name starts with a lowercase letter an error is thrown but fixing this might involve changing 10, 20+ files which would need need committing which would then be sniffed, recurse...
- We have some files that are a bit large (e.g. 4000 lines of code?) and phpcs takes several minutes to check them. Delaying the commit by this long is unacceptable.
- I haven't tested this yet but I imagine if you do a svn branch and commit it, phpcs will check everything and take a very long time to check all 1000 files?
Given that we can't refactor our whole codebase today - Does anyone know how I can use a svn commit parameter that will tell the svn pre-commit hook to not run phpcs?
Or perhaps there is another way to remove the headaches described?