mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
pre-commit: add autoflake and isort, include autoformatter config
This commit is contained in:
@@ -20,6 +20,21 @@ repos:
|
||||
# exclude it from the pyupgrade hook that will apply f-strings etc.
|
||||
exclude: bootstrap/bootstrap.py
|
||||
|
||||
# Autoformat: Python code
|
||||
- repo: https://github.com/PyCQA/autoflake
|
||||
rev: v2.1.1
|
||||
hooks:
|
||||
- id: autoflake
|
||||
# args ref: https://github.com/PyCQA/autoflake#advanced-usage
|
||||
args:
|
||||
- --in-place
|
||||
|
||||
# Autoformat: Python code
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
# Autoformat: Python code
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.3.0
|
||||
|
||||
34
pyproject.toml
Normal file
34
pyproject.toml
Normal file
@@ -0,0 +1,34 @@
|
||||
# autoflake is used for autoformatting Python code
|
||||
#
|
||||
# ref: https://github.com/PyCQA/autoflake#readme
|
||||
#
|
||||
[tool.autoflake]
|
||||
ignore-init-module-imports = true
|
||||
remove-all-unused-imports = true
|
||||
remove-duplicate-keys = true
|
||||
remove-unused-variables = true
|
||||
|
||||
|
||||
# isort is used for autoformatting Python code
|
||||
#
|
||||
# ref: https://pycqa.github.io/isort/
|
||||
#
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
||||
|
||||
# black is used for autoformatting Python code
|
||||
#
|
||||
# ref: https://black.readthedocs.io/en/stable/
|
||||
#
|
||||
[tool.black]
|
||||
# target-version should be all supported versions, see
|
||||
# https://github.com/psf/black/issues/751#issuecomment-473066811
|
||||
target_version = [
|
||||
"py36",
|
||||
"py37",
|
||||
"py38",
|
||||
"py39",
|
||||
"py310",
|
||||
"py311",
|
||||
]
|
||||
Reference in New Issue
Block a user