Semi Automated Code Quality Checks

I am nearing completion of my first milestone release for pyphanfare where the definition of done equals a working method for each API method published by Phanfare. There will no doubt be optimizations and improvements in the small python library after this point, but want to get it functional first.

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:

. pre_commit.sh

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.