Contributing to COT

Please do contribute! We only have a few simple requirements for diffs and pull requests.

Follow coding guidelines

Logging level usage

Something is wrong (such as a violation of the OVF specification) but COT was able to attempt to recover. If recovery is not possible, you should raise an Error of appropriate type instead of logging an ERROR message.
Something unexpected or risky happened that the user needs a heads-up about. This includes cases where the software had to make an uncertain choice on its own due to lack of information from the user.
Important status updates about normal operation of the software. As this is the lowest logging level enabled by default, you should keep the logs generated at this level relatively brief but meaningful.
Detailed information of interest to an advanced or inquisitive user.
Highly detailed information only useful to a developer familiar with the code.

Coding style

To verify that your code meets applicable Python coding standards, use flake8 (pip install flake8):

cot/$ flake8
./COT/tests/ E501 line too long (80 > 79 characters)
./COT/tests/ F841 local variable 'ovf' is assigned to but never used
./COT/tests/ E501 line too long (80 > 79 characters)
./COT/tests/ F841 local variable 'ova' is assigned to but never used
./COT/tests/ F841 local variable 'ovf' is assigned to but never used
./COT/ E303 too many blank lines (2)

Fix any errors it reports, and run again until no errors are reported.

Add automated unit tests

Whether adding new functionality or fixing a bug, please add appropriate unit test case(s) under COT/tests/ to cover your changes. Your changes must pass all existing and new automated test cases before your code will be accepted.

You can run the COT automated tests under a single Python version by running python ./ test.

For full testing under all supported versions as well as verifying code coverage for your tests, you should install tox (pip install tox) and coverage (pip install coverage) then run tox from the COT directory:

cot/$ tox
py26 runtests: commands[0] | coverage run --append test --quiet
py27 runtests: commands[0] | coverage run --append test --quiet
py32 runtests: commands[0] | coverage run --append test --quiet
py33 runtests: commands[0] | coverage run --append test --quiet
py34 runtests: commands[0] | coverage run --append test --quiet
pypy runtests: commands[0] | coverage run --append test --quiet
stats runtests: commands[0] | coverage combine
stats runtests: commands[1] | coverage report -i
Name                        Stmts   Miss  Cover
COT/                 4      0   100%
COT/               147      1    99%
COT/                50      0   100%
COT/                    143      6    96%
COT/         69      0   100%
COT/                 142      5    96%
COT/          159      0   100%
COT/            36      0   100%
COT/        104     40    62%
COT/           171      3    98%
COT/                    41      0   100%
COT/           87      2    98%
COT/                   1586     52    96%
COT/              173      0   100%
COT/               80      2    98%
COT/               24      0   100%
COT/      12      0   100%
COT/         119      1    99%
COT/              25      0   100%
COT/               112      0   100%
TOTAL                        3284    112    96%
stats runtests: commands[2] | coverage html -i
flake8 runtests: commands[0] | flake8
_______________ summary _______________
  clean: commands succeeded
  py26: commands succeeded
  py27: commands succeeded
  py32: commands succeeded
  py33: commands succeeded
  py34: commands succeeded
  pypy: commands succeeded
  stats: commands succeeded
  flake8: commands succeeded
  congratulations :)

After running tox you can check the code coverage details by opening htmlcov/index.html in a web browser.

Update documentation

If you add or change any COT CLI or APIs, or add or remove any external dependencies, please update the relevant documentation.

Add yourself as a contributor

If you haven’t contributed to COT previously, be sure to add yourself as a contributor in the COPYRIGHT.txt file.