mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-14 05:36:58 +03:00
Add pre-commit for the generated project. (#2171)
This commit is contained in:
commit
d68db825e2
|
@ -139,6 +139,7 @@ Listed in alphabetical order.
|
||||||
Keyvan Mosharraf `@keyvanm`_
|
Keyvan Mosharraf `@keyvanm`_
|
||||||
Krzysztof Szumny `@noisy`_
|
Krzysztof Szumny `@noisy`_
|
||||||
Krzysztof Żuraw `@krzysztofzuraw`_
|
Krzysztof Żuraw `@krzysztofzuraw`_
|
||||||
|
Leo won `@leollon`_
|
||||||
Leo Zhou `@glasslion`_
|
Leo Zhou `@glasslion`_
|
||||||
Leonardo Jimenez `@xpostudio4`_
|
Leonardo Jimenez `@xpostudio4`_
|
||||||
Lin Xianyi `@iynaix`_
|
Lin Xianyi `@iynaix`_
|
||||||
|
@ -295,6 +296,7 @@ Listed in alphabetical order.
|
||||||
.. _@keyvanm: https://github.com/keyvanm
|
.. _@keyvanm: https://github.com/keyvanm
|
||||||
.. _@knitatoms: https://github.com/knitatoms
|
.. _@knitatoms: https://github.com/knitatoms
|
||||||
.. _@krzysztofzuraw: https://github.com/krzysztofzuraw
|
.. _@krzysztofzuraw: https://github.com/krzysztofzuraw
|
||||||
|
.. _@leollon: https://github.com/leollon
|
||||||
.. _@MathijsHoogland: https://github.com/MathijsHoogland
|
.. _@MathijsHoogland: https://github.com/MathijsHoogland
|
||||||
.. _@mapx: https://github.com/mapx
|
.. _@mapx: https://github.com/mapx
|
||||||
.. _@mattayes: https://github.com/mattayes
|
.. _@mattayes: https://github.com/mattayes
|
||||||
|
|
|
@ -53,6 +53,7 @@ Features
|
||||||
* Instructions for deploying to PythonAnywhere_
|
* Instructions for deploying to PythonAnywhere_
|
||||||
* Run tests with unittest or pytest
|
* Run tests with unittest or pytest
|
||||||
* Customizable PostgreSQL version
|
* Customizable PostgreSQL version
|
||||||
|
* Default integration with pre-commit_ for identifying simple issues before submission to code review
|
||||||
|
|
||||||
.. _`maintained Foundation fork`: https://github.com/Parbhat/cookiecutter-django-foundation
|
.. _`maintained Foundation fork`: https://github.com/Parbhat/cookiecutter-django-foundation
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ Optional Integrations
|
||||||
.. _PythonAnywhere: https://www.pythonanywhere.com/
|
.. _PythonAnywhere: https://www.pythonanywhere.com/
|
||||||
.. _Traefik: https://traefik.io/
|
.. _Traefik: https://traefik.io/
|
||||||
.. _LetsEncrypt: https://letsencrypt.org/
|
.. _LetsEncrypt: https://letsencrypt.org/
|
||||||
|
.. _pre-commit: https://github.com/pre-commit/pre-commit
|
||||||
|
|
||||||
Constraints
|
Constraints
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -26,6 +26,12 @@ First things first.
|
||||||
#. Install development requirements: ::
|
#. Install development requirements: ::
|
||||||
|
|
||||||
$ pip install -r requirements/local.txt
|
$ pip install -r requirements/local.txt
|
||||||
|
$ pre-commit install
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
the `pre-commit` exists in the generated project as default.
|
||||||
|
for the details of `pre-commit`, follow the [site of pre-commit](https://pre-commit.com/).
|
||||||
|
|
||||||
#. Create a new PostgreSQL database using createdb_: ::
|
#. Create a new PostgreSQL database using createdb_: ::
|
||||||
|
|
||||||
|
|
19
{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Normal file
19
{{cookiecutter.project_slug}}/.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
exclude: 'docs|node_modules|migrations|.git|.tox'
|
||||||
|
default_stages: [commit]
|
||||||
|
fail_fast: true
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: master
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
files: (^|/)a/.+\.(py|html|sh|css|js)$
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
name: flake8
|
||||||
|
entry: flake8
|
||||||
|
language: python
|
||||||
|
types: [python]
|
||||||
|
|
|
@ -24,6 +24,7 @@ pylint-django==2.0.11 # https://github.com/PyCQA/pylint-django
|
||||||
{%- if cookiecutter.use_celery == 'y' %}
|
{%- if cookiecutter.use_celery == 'y' %}
|
||||||
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
|
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
pre-commit==1.20.0 # https://github.com/pre-commit/pre-commit
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user