Browse Source

Use flake8 to check for pep8 erros

Peter Justin 8 years ago
parent
commit
35f5018bd7
3 changed files with 12 additions and 1 deletions
  1. 3 0
      CONTRIBUTING.md
  2. 8 1
      Makefile
  3. 1 0
      requirements-dev.txt

+ 3 - 0
CONTRIBUTING.md

@@ -25,6 +25,9 @@ Follow the [PEP8 style guide][pep8].
 
 
   [pep8]: https://www.python.org/dev/peps/pep-0008/
   [pep8]: https://www.python.org/dev/peps/pep-0008/
 
 
+You can check if your code follows the PEP8, either by running ``make lint``
+or by executing ``flake8`` directly.
+
 FlaskBB is depending on a few python packages for development. One of those is
 FlaskBB is depending on a few python packages for development. One of those is
 [py.test][pytest] which runs our testsuite. Just use the provided
 [py.test][pytest] which runs our testsuite. Just use the provided
 ``requirements-dev.txt`` file and you should be good to go.
 ``requirements-dev.txt`` file and you should be good to go.

+ 8 - 1
Makefile

@@ -1,10 +1,11 @@
-.PHONY: clean install help test run dependencies docs
+.PHONY: clean install help test lint run dependencies docs
 
 
 help:
 help:
 	@echo "  clean      remove unwanted stuff"
 	@echo "  clean      remove unwanted stuff"
 	@echo "  install    install dependencies and flaskbb"
 	@echo "  install    install dependencies and flaskbb"
 	@echo "  devconfig  generates a development config"
 	@echo "  devconfig  generates a development config"
 	@echo "  test       run the testsuite"
 	@echo "  test       run the testsuite"
+	@echo "  lint       check the source for style errors"
 	@echo "  run        run the development server with the development config"
 	@echo "  run        run the development server with the development config"
 	@echo "  docs       build the documentation"
 	@echo "  docs       build the documentation"
 
 
@@ -32,3 +33,9 @@ install:dependencies
 
 
 docs:
 docs:
 	$(MAKE) -C docs html
 	$(MAKE) -C docs html
+
+lint:check
+	flake8
+
+check:
+	@type flake8 >/dev/null 2>&1 || echo "Flake8 is not installed. You can install it with 'pip install flake8'."

+ 1 - 0
requirements-dev.txt

@@ -6,3 +6,4 @@ pytest
 pytest-cov
 pytest-cov
 Sphinx
 Sphinx
 alabaster
 alabaster
+flake8