2015-09-18 20:20:48 +03:00
|
|
|
Linters
|
|
|
|
=======
|
|
|
|
|
2015-09-19 00:26:29 +03:00
|
|
|
.. index:: linters
|
2015-09-24 10:38:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
flake8
|
|
|
|
-------
|
|
|
|
|
|
|
|
To run flake8:
|
|
|
|
|
|
|
|
$ flake8
|
|
|
|
|
|
|
|
The config for flake8 is located in setup.cfg. It specifies:
|
|
|
|
|
|
|
|
* Set max line length to 120 chars
|
|
|
|
* Exclude .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
2015-09-26 10:35:55 +03:00
|
|
|
|
|
|
|
pylint
|
|
|
|
------
|
|
|
|
|
|
|
|
This is included in flake8's checks, but you can also run it separately to see a more detailed report:
|
|
|
|
|
|
|
|
$ pylint <python files that you wish to lint>
|
|
|
|
|
2015-09-26 10:50:54 +03:00
|
|
|
The config for pylint is located in .pylintrc. It specifies:
|
|
|
|
|
|
|
|
* Use the pylint_common and pylint_django plugins. If using Celery, also use pylint_celery.
|
|
|
|
* Set max line length to 120 chars
|
|
|
|
* Disable linting messages for missing docstring and invalid name
|
|
|
|
* max-parents=13
|
|
|
|
|
2015-09-26 10:35:55 +03:00
|
|
|
pep8
|
|
|
|
-----
|
|
|
|
|
|
|
|
This is included in flake8's checks, but you can also run it separately to see a more detailed report:
|
|
|
|
|
|
|
|
$ pep8 <python files that you wish to lint>
|
2015-09-26 10:50:54 +03:00
|
|
|
|
|
|
|
The config for pep8 is located in setup.cfg. It specifies:
|
|
|
|
|
|
|
|
* Set max line length to 120 chars
|
2016-06-19 22:24:43 +03:00
|
|
|
* Exclude .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
|
|
|
|
|
|
|
|
|
|
|
eslint
|
|
|
|
------
|
|
|
|
|
|
|
|
If you are using webpack, an ``.eslint`` file will be generated in your project base.
|
|
|
|
|
|
|
|
Running the karma tests will also run the linter.
|
|
|
|
|
|
|
|
$ npm test
|
|
|
|
|
|
|
|
You can manually run the eslint from your project root too:
|
|
|
|
|
|
|
|
$ eslint <javascript files that you wish to lint>
|
|
|
|
|
|
|
|
Using the flag ``--fix`` will atomatically fix any errors.
|