mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-15 01:14:53 +03:00
Fix inconsistent line length and move config to pyproject.toml
Fix #2720
This commit is contained in:
parent
5fb1550c71
commit
3db8f6acf3
29
pyproject.toml
Normal file
29
pyproject.toml
Normal file
|
@ -0,0 +1,29 @@
|
|||
# ==== pytest ====
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "-v --tb=short"
|
||||
norecursedirs = [
|
||||
".tox",
|
||||
".git",
|
||||
"*/migrations/*",
|
||||
"*/static/*",
|
||||
"docs",
|
||||
"venv",
|
||||
"*/{{cookiecutter.project_slug}}/*",
|
||||
]
|
||||
|
||||
|
||||
# ==== black ====
|
||||
[tool.black]
|
||||
line-length = 119
|
||||
target-version = ['py311']
|
||||
|
||||
|
||||
# ==== isort ====
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
line_length = 119
|
||||
known_first_party = [
|
||||
"tests",
|
||||
"scripts",
|
||||
"hooks",
|
||||
]
|
|
@ -1,3 +0,0 @@
|
|||
[pytest]
|
||||
addopts = -v --tb=short
|
||||
norecursedirs = .tox .git */migrations/* */static/* docs venv */{{cookiecutter.project_slug}}/*
|
|
@ -1,7 +0,0 @@
|
|||
[flake8]
|
||||
exclude = docs
|
||||
max-line-length = 88
|
||||
|
||||
[isort]
|
||||
profile = black
|
||||
known_first_party = tests,scripts,hooks
|
|
@ -44,8 +44,6 @@ repos:
|
|||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ['--config=setup.cfg']
|
||||
additional_dependencies: [flake8-isort]
|
||||
|
||||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
|
||||
ci:
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
[MASTER]
|
||||
load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery{% endif %}
|
||||
django-settings-module=config.settings.local
|
||||
[FORMAT]
|
||||
max-line-length=120
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=missing-docstring,invalid-name
|
||||
|
||||
[DESIGN]
|
||||
max-parents=13
|
||||
|
||||
[TYPECHECK]
|
||||
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete
|
92
{{cookiecutter.project_slug}}/pyproject.toml
Normal file
92
{{cookiecutter.project_slug}}/pyproject.toml
Normal file
|
@ -0,0 +1,92 @@
|
|||
# ==== pytest ====
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "6.0"
|
||||
addopts = "--ds=config.settings.test --reuse-db"
|
||||
python_files = [
|
||||
"tests.py",
|
||||
"test_*.py",
|
||||
]
|
||||
{%- if cookiecutter.frontend_pipeline == 'Gulp' %}
|
||||
norecursedirs = ["node_modules"]
|
||||
{%- endif %}
|
||||
|
||||
# ==== Coverage ====
|
||||
[tool.coverage.run]
|
||||
include = ["{{cookiecutter.project_slug}}/**"]
|
||||
omit = ["*/migrations/*", "*/tests/*"]
|
||||
plugins = ["django_coverage_plugin"]
|
||||
|
||||
|
||||
# ==== black ====
|
||||
[tool.black]
|
||||
line-length = 119
|
||||
target-version = ['py311']
|
||||
|
||||
|
||||
# ==== isort ====
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
line_length = 119
|
||||
known_first_party = [
|
||||
"{{cookiecutter.project_slug}}",
|
||||
"config",
|
||||
]
|
||||
skip = ["venv/"]
|
||||
skip_glob = ["**/migrations/*.py"]
|
||||
|
||||
|
||||
# ==== mypy ====
|
||||
[tool.mypy]
|
||||
python_version = "3.11"
|
||||
check_untyped_defs = true
|
||||
ignore_missing_imports = true
|
||||
warn_unused_ignores = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_configs = true
|
||||
plugins = [
|
||||
"mypy_django_plugin.main",
|
||||
{%- if cookiecutter.use_drf == "y" %}
|
||||
"mypy_drf_plugin.main",
|
||||
{%- endif %}
|
||||
]
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
# Django migrations should not produce any errors:
|
||||
module = "*.migrations.*"
|
||||
ignore_errors = true
|
||||
|
||||
[tool.django-stubs]
|
||||
django_settings_module = "config.settings.test"
|
||||
|
||||
|
||||
# ==== PyLint ====
|
||||
[tool.pylint.MASTER]
|
||||
load-plugins = [
|
||||
"pylint_django",
|
||||
{%- if cookiecutter.use_celery == "y" %}
|
||||
"pylint_celery",
|
||||
{%- endif %}
|
||||
]
|
||||
django-settings-module = "config.settings.local"
|
||||
|
||||
[tool.pylint.FORMAT]
|
||||
max-line-length = 119
|
||||
|
||||
[tool.pylint."MESSAGES CONTROL"]
|
||||
disable = [
|
||||
"missing-docstring",
|
||||
"invalid-name",
|
||||
]
|
||||
|
||||
[tool.pylint.DESIGN]
|
||||
max-parents = 13
|
||||
|
||||
[tool.pylint.TYPECHECK]
|
||||
generated-members = [
|
||||
"REQUEST",
|
||||
"acl_users",
|
||||
"aq_parent",
|
||||
"[a-zA-Z]+_set{1,2}",
|
||||
"save",
|
||||
"delete",
|
||||
]
|
|
@ -1,6 +0,0 @@
|
|||
[pytest]
|
||||
addopts = --ds=config.settings.test --reuse-db
|
||||
python_files = tests.py test_*.py
|
||||
{%- if cookiecutter.frontend_pipeline == 'Gulp' %}
|
||||
norecursedirs = node_modules
|
||||
{%- endif %}
|
|
@ -1,40 +1,10 @@
|
|||
# flake8 and pycodestyle don't support pyproject.toml
|
||||
# https://github.com/PyCQA/flake8/issues/234
|
||||
# https://github.com/PyCQA/pycodestyle/issues/813
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
max-line-length = 119
|
||||
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv
|
||||
|
||||
[pycodestyle]
|
||||
max-line-length = 120
|
||||
max-line-length = 119
|
||||
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv
|
||||
|
||||
[isort]
|
||||
line_length = 88
|
||||
known_first_party = {{cookiecutter.project_slug}},config
|
||||
multi_line_output = 3
|
||||
default_section = THIRDPARTY
|
||||
skip = venv/
|
||||
skip_glob = **/migrations/*.py
|
||||
include_trailing_comma = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
|
||||
[mypy]
|
||||
python_version = 3.11
|
||||
check_untyped_defs = True
|
||||
ignore_missing_imports = True
|
||||
warn_unused_ignores = True
|
||||
warn_redundant_casts = True
|
||||
warn_unused_configs = True
|
||||
plugins = mypy_django_plugin.main{% if cookiecutter.use_drf == "y" %}, mypy_drf_plugin.main{% endif %}
|
||||
|
||||
[mypy.plugins.django-stubs]
|
||||
django_settings_module = config.settings.test
|
||||
|
||||
[mypy-*.migrations.*]
|
||||
# Django migrations should not produce any errors:
|
||||
ignore_errors = True
|
||||
|
||||
[coverage:run]
|
||||
include = {{cookiecutter.project_slug}}/**
|
||||
omit = */migrations/*, */tests/*
|
||||
plugins =
|
||||
django_coverage_plugin
|
||||
|
|
Loading…
Reference in New Issue
Block a user