Skip to content

Commit e57e6dd

Browse files
committed
Add yapf to travis and updates CONTRIBUTING doc python-telegram-bot#259
1 parent 49122d6 commit e57e6dd

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ install:
1313
- pip install -r requirements-dev.txt
1414
script:
1515
- nosetests -v --with-flaky --no-flaky-report --with-coverage --cover-package=telegram/
16+
- yapf -r telegram
1617
- flake8 telegram
1718
- 'if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pylint -E telegram --disable=no-name-in-module,import-error; fi'
1819
after_success:

CONTRIBUTING.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ Setting things up
2222

2323
``$ pip install -r requirements.txt -r requirements-dev.txt``
2424

25+
26+
5. Install pre-commit hooks:
27+
28+
``$ pre-commit install``
29+
2530
Finding something to do
2631
-----------------------
2732

@@ -68,18 +73,20 @@ Here's how to make a one-off code change.
6873

6974
- Add yourself to the AUTHORS.rst_ file in an alphabetical fashion.
7075

71-
- Before making a commit ensure that all automated tests, pep8 & lint validations still pass:
76+
- Before making a commit ensure that all automated tests still pass:
7277

7378
``$ make test``
7479

75-
``$ make pep8``
80+
- To actually make the commit (this will trigger test for yapf, lint and pep8 automatically):
7681

77-
``$ make lint``
82+
``$ git add your-file-changed.py``
7883

79-
- To actually make the commit and push it to your GitHub fork, run:
84+
- yapf may change code formatting, make sure to re-add them to your commit.
8085

8186
``$ git commit -a -m "your-commit-message-here"``
8287

88+
- Finally, push it to your GitHub fork, run:
89+
8390
``$ git push origin your-branch-name``
8491

8592
4. **When your feature is ready to merge, create a pull request.**

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
.DEFAULT_GOAL := help
2-
.PHONY: clean pep8 lint test install
2+
.PHONY: clean pep257 pep8 yapf lint test install
33

44
PYLINT := pylint
55
NOSETESTS := nosetests
66
PEP257 := pep257
77
PEP8 := flake8
8+
YAPF := yapf
89
PIP := pip
910

1011
clean:
@@ -19,7 +20,10 @@ pep257:
1920
$(PEP257) telegram
2021

2122
pep8:
22-
$(PEP8) telegram
23+
$(PEP8) telegram
24+
25+
yapf:
26+
$(YAPF) -r telegram
2327

2428
lint:
2529
$(PYLINT) -E telegram --disable=no-name-in-module,import-error
@@ -36,11 +40,13 @@ help:
3640
@echo "- pep257 Check docstring style with pep257"
3741
@echo "- pep8 Check style with flake8"
3842
@echo "- lint Check style with pylint"
43+
@echo "- yapf Check style with yapf"
3944
@echo "- test Run tests"
4045
@echo
4146
@echo "Available variables:"
4247
@echo "- PYLINT default: $(PYLINT)"
4348
@echo "- NOSETESTS default: $(NOSETESTS)"
4449
@echo "- PEP257 default: $(PEP257)"
4550
@echo "- PEP8 default: $(PEP8)"
51+
@echo "- YAPF default: $(YAPF)"
4652
@echo "- PIP default: $(PIP)"

0 commit comments

Comments
 (0)