Commit f38c3b6e by Bjorn Neergaard

feat(ci): modernize pre-commit and mypy config

parent 2589eb67
ci:
autofix_prs: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-case-conflict
- id: check-toml
- id: check-json
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii, --no-sort-keys]
- id: check-ast
- id: debug-statements
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
types: [python] # FIXME: pyi support that doesn't conflict with black
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 21.10b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]
additional_dependencies:
- flake8-bugbear
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
rev: v0.910-1
hooks:
- id: mypy
pass_filenames: false
additional_dependencies:
- types-dataclasses
- types-requests
args:
- poetry
- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
hooks:
- id: isort
additional_dependencies: [toml]
exclude: ^.*/?setup\.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
exclude: |
(?x)(
^tests/.*/fixtures/.*
| ^tests/console/commands/debug/test_resolve.py
)
- id: end-of-file-fixer
exclude: ^tests/.*/fixtures/.*
- id: debug-statements
ci:
autofix_prs: false
[mypy]
check_untyped_defs = True
ignore_errors = False
ignore_missing_imports = True
strict_optional = True
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True
# The following whitelist is used to allow for incremental adoption
# of Mypy. Modules should be removed from this whitelist as and when
# their respective type errors have been addressed. No new modules
# should be added to this whitelist.
# see https://github.com/python-poetry/poetry/pull/4510.
[mypy-poetry.config.file_config_source]
ignore_errors = True
[mypy-poetry.console.*]
ignore_errors = True
[mypy-poetry.factory.*]
ignore_errors = True
[mypy-poetry.inspection.*]
ignore_errors = True
[mypy-poetry.installation.*]
ignore_errors = True
[mypy-poetry.layouts.*]
ignore_errors = True
[mypy-poetry.mixology.*]
ignore_errors = True
[mypy-poetry.packages.locker]
ignore_errors = True
[mypy-poetry.puzzle.*]
ignore_errors = True
[mypy-poetry.repositories.installed_repository]
ignore_errors = True
[mypy-poetry.utils.*]
ignore_errors = True
# end of whitelist
......@@ -72,38 +72,56 @@ build-backend = "poetry.core.masonry.api"
[tool.isort]
py_version = 36
profile = "black"
force_single_line = true
atomic = true
include_trailing_comma = true
lines_after_imports = 2
combine_as_imports = true
lines_between_types = 1
use_parentheses = true
lines_after_imports = 2
src_paths = ["poetry", "tests"]
skip_glob = ["*/setup.py"]
filter_files = true
known_first_party = "poetry"
extend_skip = ["setup.py"]
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| tests/.*/setup.py
)/
target-version = ['py36']
force-exclude = '''
.*/setup\.py$
'''
[tool.mypy]
python_version = "3.6"
check_untyped_defs = true
ignore_missing_imports = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
files = "poetry"
# The following whitelist is used to allow for incremental adoption
# of Mypy. Modules should be removed from this whitelist as and when
# their respective type errors have been addressed. No new modules
# should be added to this whitelist.
# see https://github.com/python-poetry/poetry/pull/4510.
[[tool.mypy.overrides]]
module = [
'poetry.poetry',
'poetry.config.file_config_source',
'poetry.console.*',
'poetry.factory.*',
'poetry.inspection.*',
'poetry.installation.*',
'poetry.layouts.*',
'poetry.mixology.*',
'poetry.packages.locker',
'poetry.puzzle.*',
'poetry.repositories.installed_repository',
'poetry.utils.*'
]
ignore_errors = true
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment