2015-05-19 08:09:42 +00:00
|
|
|
If you're reading this, you may have interest in enhancing topydo. Thank you!
|
|
|
|
|
2015-05-22 19:26:23 +00:00
|
|
|
Please read the following guidelines to get your enhancement / bug fixes
|
2015-06-13 01:21:05 +00:00
|
|
|
smoothly into topydo.
|
|
|
|
|
|
|
|
### General
|
2015-05-19 08:09:42 +00:00
|
|
|
|
2015-10-06 12:36:29 +00:00
|
|
|
* Use descriptive commit messages. The post
|
|
|
|
[How to write a commit message](http://chris.beams.io/posts/git-commit/) by
|
|
|
|
Chris Beams has some good guidelines.
|
2015-06-13 01:21:05 +00:00
|
|
|
|
|
|
|
### Coding style
|
|
|
|
|
|
|
|
* Please try to adhere to the coding style dictated by `pylint` as much
|
|
|
|
possible. I won't be very picky about long lines, but please try to avoid
|
|
|
|
them.
|
|
|
|
* I strongly prefer simple and short functions, doing only one thing. I'll
|
2015-11-10 12:00:14 +00:00
|
|
|
ask you to refactor functions with massive indentation or don't fit
|
2015-06-13 01:21:05 +00:00
|
|
|
otherwise on a screen.
|
|
|
|
|
|
|
|
### Testing
|
|
|
|
|
2015-11-10 12:00:14 +00:00
|
|
|
* First make sure to have the prerequisites installed to perform the tests:
|
2015-05-19 08:09:42 +00:00
|
|
|
|
2015-11-10 12:00:14 +00:00
|
|
|
pip install .[test]
|
|
|
|
|
|
|
|
* Then, run the tests with:
|
|
|
|
|
|
|
|
green -r
|
2015-05-22 19:26:23 +00:00
|
|
|
|
|
|
|
Obviously, I won't accept anything that makes the tests fail. When you submit
|
|
|
|
a Pull Request, Travis CI will automatically run all tests for various Python
|
|
|
|
versions, but it's better if you run the tests locally first.
|
2015-11-14 21:30:32 +00:00
|
|
|
* Travis CI will also run `pylint` and fail when new errors are introduced. You
|
|
|
|
may want to add a `pre-push` script to your topydo clone before pushing to
|
|
|
|
Github (.git/hooks/pre-push):
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
remote="$1"
|
|
|
|
|
|
|
|
if [ $remote = "origin" ]; then
|
|
|
|
if ! green; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! python3 -m pylint --errors-only topydo test; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
Make sure to run `chmod +x .git/hooks/pre-push` to activate the hook.
|
|
|
|
|
2015-05-19 08:09:42 +00:00
|
|
|
* Add tests for your change(s):
|
2015-11-10 12:00:14 +00:00
|
|
|
* Bugfixes: add a test case that covers your bugfix, so the bug won't happen
|
2015-05-22 19:26:23 +00:00
|
|
|
ever again.
|
2015-11-10 12:00:14 +00:00
|
|
|
* Features: add test cases that checks various inputs and outputs of your
|
2015-05-22 19:26:23 +00:00
|
|
|
feature. Be creative in trying to break the feature you've just implemented.
|
2015-11-10 12:00:14 +00:00
|
|
|
* Check the test coverage of your contributed code, in particular if you touched
|
|
|
|
code in the topydo.lib or topydo.command packages:
|
2015-05-19 08:09:42 +00:00
|
|
|
|
2015-11-10 12:00:14 +00:00
|
|
|
coverage report -m
|
2015-06-13 01:21:05 +00:00
|
|
|
|
|
|
|
Or alternatively, for a more friendly output, run:
|
|
|
|
|
|
|
|
coverage html
|
|
|
|
|
2015-11-10 12:00:14 +00:00
|
|
|
which will generate annotated files in the *htmlcov* folder. The new code
|
2015-06-13 01:21:05 +00:00
|
|
|
should be marked green (i.e. covered).
|
2015-11-10 12:00:14 +00:00
|
|
|
|
|
|
|
When you create a Pull Request, code coverage will be automatically checked
|
2020-10-04 17:21:45 +00:00
|
|
|
and reported by [Codecov.io](https://codecov.io/github/topydo/topydo).
|