Add yapf to travis and updates CONTRIBUTING doc #259

This commit is contained in:
Leandro Toledo 2016-05-14 23:46:21 -03:00
parent 49122d6a99
commit e57e6dd645
3 changed files with 20 additions and 6 deletions

View file

@ -13,6 +13,7 @@ install:
- pip install -r requirements-dev.txt - pip install -r requirements-dev.txt
script: script:
- nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/ - nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/
- yapf -r telegram
- flake8 telegram - flake8 telegram
- 'if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pylint -E telegram --disable=no-name-in-module,import-error; fi' - 'if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pylint -E telegram --disable=no-name-in-module,import-error; fi'
after_success: after_success:

View file

@ -22,6 +22,11 @@ Setting things up
``$ pip install -r requirements.txt -r requirements-dev.txt`` ``$ pip install -r requirements.txt -r requirements-dev.txt``
5. Install pre-commit hooks:
``$ pre-commit install``
Finding something to do Finding something to do
----------------------- -----------------------
@ -68,18 +73,20 @@ Here's how to make a one-off code change.
- Add yourself to the AUTHORS.rst_ file in an alphabetical fashion. - Add yourself to the AUTHORS.rst_ file in an alphabetical fashion.
- Before making a commit ensure that all automated tests, pep8 & lint validations still pass: - Before making a commit ensure that all automated tests still pass:
``$ make test`` ``$ make test``
``$ make pep8`` - To actually make the commit (this will trigger test for yapf, lint and pep8 automatically):
``$ make lint`` ``$ git add your-file-changed.py``
- To actually make the commit and push it to your GitHub fork, run: - yapf may change code formatting, make sure to re-add them to your commit.
``$ git commit -a -m "your-commit-message-here"`` ``$ git commit -a -m "your-commit-message-here"``
- Finally, push it to your GitHub fork, run:
``$ git push origin your-branch-name`` ``$ git push origin your-branch-name``
4. **When your feature is ready to merge, create a pull request.** 4. **When your feature is ready to merge, create a pull request.**

View file

@ -1,10 +1,11 @@
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
.PHONY: clean pep8 lint test install .PHONY: clean pep257 pep8 yapf lint test install
PYLINT := pylint PYLINT := pylint
NOSETESTS := nosetests NOSETESTS := nosetests
PEP257 := pep257 PEP257 := pep257
PEP8 := flake8 PEP8 := flake8
YAPF := yapf
PIP := pip PIP := pip
clean: clean:
@ -19,7 +20,10 @@ pep257:
$(PEP257) telegram $(PEP257) telegram
pep8: pep8:
$(PEP8) telegram $(PEP8) telegram
yapf:
$(YAPF) -r telegram
lint: lint:
$(PYLINT) -E telegram --disable=no-name-in-module,import-error $(PYLINT) -E telegram --disable=no-name-in-module,import-error
@ -36,6 +40,7 @@ help:
@echo "- pep257 Check docstring style with pep257" @echo "- pep257 Check docstring style with pep257"
@echo "- pep8 Check style with flake8" @echo "- pep8 Check style with flake8"
@echo "- lint Check style with pylint" @echo "- lint Check style with pylint"
@echo "- yapf Check style with yapf"
@echo "- test Run tests" @echo "- test Run tests"
@echo @echo
@echo "Available variables:" @echo "Available variables:"
@ -43,4 +48,5 @@ help:
@echo "- NOSETESTS default: $(NOSETESTS)" @echo "- NOSETESTS default: $(NOSETESTS)"
@echo "- PEP257 default: $(PEP257)" @echo "- PEP257 default: $(PEP257)"
@echo "- PEP8 default: $(PEP8)" @echo "- PEP8 default: $(PEP8)"
@echo "- YAPF default: $(YAPF)"
@echo "- PIP default: $(PIP)" @echo "- PIP default: $(PIP)"