April 21, 2008
Semi Automated Code Quality Checks
To help keep me in line with PEP 8 and good testable code, I have come up with the following strategy and I am really liking so I thought I'd share.
I use pylint and doctest to validate my code prior to each commit (haven't figured out how to wire up a pre-commit hook in git yet, or else the title of this post would be Fully Automated instead of Semi Automated). I have put these commands into this little script:
1 2 3 4
#!/bin/bash # pre_commit.sh pylint -f colorized -i y --ignore=tests pyphanfare python run_tests.py
Now prior to each commit, I run:
and verify that all tests passed and I have a score of 10.0/10 in pylint. My pylint score of 10.0/10 is not completely accurate as I cheat where I deem appropriate and put the comments in the code to disable certain messages that crop up as offending but I don't feel the need to change:
# pylint: disable-msg=MSG_ID
I have a Lighthouse project tracker set up that is integrated with GitHub. So please stop by and let me know of anything you'd like to see out this library or if you'd like to help out.