mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
add autoflake to lint and move config to pyproject.toml
This commit is contained in:
@ -18,6 +18,10 @@ repos:
|
||||
additional_dependencies:
|
||||
- flake8-bugbear==23.9.16
|
||||
exclude: setup.py
|
||||
- repo: https://github.com/PyCQA/autoflake
|
||||
rev: v2.2.1
|
||||
hooks:
|
||||
- id: autoflake
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
@ -26,6 +30,8 @@ repos:
|
||||
rev: 6.3.0
|
||||
hooks:
|
||||
- id: pydocstyle
|
||||
additional_dependencies:
|
||||
- tomli # required until >= python311
|
||||
- repo: https://github.com/executablebooks/mdformat
|
||||
rev: 0.7.17
|
||||
hooks:
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
[pydocstyle]
|
||||
; All error codes found here:
|
||||
; http://www.pydocstyle.org/en/3.0.0/error_codes.html
|
||||
;
|
||||
; Ignored:
|
||||
; D1 - Missing docstring error codes
|
||||
;
|
||||
; Selected:
|
||||
; D2 - Whitespace error codes
|
||||
; D3 - Quote error codes
|
||||
; D4 - Content related error codes
|
||||
select=D2,D3,D4
|
||||
|
||||
; Extra ignores:
|
||||
; D200 - One-line docstring should fit on one line with quotes
|
||||
; D203 - 1 blank line required before class docstring
|
||||
; D204 - 1 blank line required after class docstring
|
||||
; D205 - 1 blank line required between summary line and description
|
||||
; D212 - Multi-line docstring summary should start at the first line
|
||||
; D302 - Use u""" for Unicode docstrings
|
||||
; D400 - First line should end with a period
|
||||
; D401 - First line should be in imperative mood
|
||||
; D412 - No blank lines allowed between a section header and its content
|
||||
add-ignore=D200,D203,D204,D205,D212,D302,D400,D401,D412
|
||||
|
||||
; Explanation:
|
||||
; D400 - Enabling this error code seems to make it a requirement that the first
|
||||
; sentence in a docstring is not split across two lines. It also makes it a
|
||||
; requirement that no docstring can have a multi-sentence description without a
|
||||
; summary line. Neither one of those requirements seem appropriate.
|
||||
5
Makefile
5
Makefile
@ -25,7 +25,10 @@ clean-pyc:
|
||||
find . -name '__pycache__' -exec rm -rf {} +
|
||||
|
||||
lint:
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
@pre-commit run --all-files --show-diff-on-failure || ( \
|
||||
echo "\n\n\n * pre-commit should have fixed the errors above. Running again to make sure everything is good..." \
|
||||
&& pre-commit run --all-files --show-diff-on-failure \
|
||||
)
|
||||
|
||||
test:
|
||||
pytest tests
|
||||
|
||||
16
mypy.ini
16
mypy.ini
@ -1,16 +0,0 @@
|
||||
[mypy]
|
||||
|
||||
check_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
disallow_untyped_defs = True
|
||||
disallow_any_generics = True
|
||||
disallow_untyped_calls = True
|
||||
disallow_untyped_decorators = True
|
||||
disallow_subclassing_any = True
|
||||
ignore_missing_imports = True
|
||||
strict_optional = True
|
||||
strict_equality = True
|
||||
warn_redundant_casts = True
|
||||
warn_return_any = True
|
||||
warn_unused_configs = True
|
||||
warn_unused_ignores = True
|
||||
@ -1,3 +1,71 @@
|
||||
[tool.autoflake]
|
||||
remove_all_unused_imports = "True"
|
||||
exclude = "__init__.py"
|
||||
|
||||
[tool.isort]
|
||||
combine_as_imports = "True"
|
||||
extra_standard_library = "pytest"
|
||||
force_grid_wrap = 1
|
||||
force_sort_within_sections = "True"
|
||||
known_third_party = "hypothesis,pytest"
|
||||
known_first_party = "<MODULE_NAME>"
|
||||
multi_line_output = 3
|
||||
profile = "black"
|
||||
|
||||
[tool.mypy]
|
||||
check_untyped_defs = "True"
|
||||
disallow_incomplete_defs = "True"
|
||||
disallow_untyped_defs = "True"
|
||||
disallow_any_generics = "True"
|
||||
disallow_untyped_calls = "True"
|
||||
disallow_untyped_decorators = "True"
|
||||
disallow_subclassing_any = "True"
|
||||
ignore_missing_imports = "True"
|
||||
strict_optional = "True"
|
||||
strict_equality = "True"
|
||||
warn_redundant_casts = "True"
|
||||
warn_return_any = "True"
|
||||
warn_unused_configs = "True"
|
||||
warn_unused_ignores = "True"
|
||||
|
||||
|
||||
[tool.pydocstyle]
|
||||
# All error codes found here:
|
||||
# http://www.pydocstyle.org/en/3.0.0/error_codes.html
|
||||
#
|
||||
# Ignored:
|
||||
# D1 - Missing docstring error codes
|
||||
#
|
||||
# Selected:
|
||||
# D2 - Whitespace error codes
|
||||
# D3 - Quote error codes
|
||||
# D4 - Content related error codes
|
||||
select = "D2,D3,D4"
|
||||
|
||||
# Extra ignores:
|
||||
# D200 - One-line docstring should fit on one line with quotes
|
||||
# D203 - 1 blank line required before class docstring
|
||||
# D204 - 1 blank line required after class docstring
|
||||
# D205 - 1 blank line required between summary line and description
|
||||
# D212 - Multi-line docstring summary should start at the first line
|
||||
# D302 - Use u""" for Unicode docstrings
|
||||
# D400 - First line should end with a period
|
||||
# D401 - First line should be in imperative mood
|
||||
# D412 - No blank lines allowed between a section header and its content
|
||||
add-ignore = "D200,D203,D204,D205,D212,D302,D400,D401,D412,D415"
|
||||
|
||||
# Explanation:
|
||||
# D400 - Enabling this error code seems to make it a requirement that the first
|
||||
# sentence in a docstring is not split across two lines. It also makes it a
|
||||
# requirement that no docstring can have a multi-sentence description without a
|
||||
# summary line. Neither one of those requirements seem appropriate.
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "-v --showlocals --durations 10"
|
||||
xfail_strict = "True"
|
||||
log_format = "%(levelname)8s %(asctime)s %(filename)20s %(message)s"
|
||||
log_date_format = "%m-%d %H:%M:%S"
|
||||
|
||||
[tool.towncrier]
|
||||
# Read https://github.com/ethereum/<REPO_NAME>/blob/main/newsfragments/README.md for instructions
|
||||
package = "<MODULE_NAME>"
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
[pytest]
|
||||
addopts= -v --showlocals --durations 10
|
||||
xfail_strict=true
|
||||
log_format = %(levelname)8s %(asctime)s %(filename)20s %(message)s
|
||||
log_date_format = %m-%d %H:%M:%S
|
||||
|
||||
[pytest-watch]
|
||||
runner= pytest --failed-first --maxfail=1 --no-success-flaky-report
|
||||
9
tox.ini
9
tox.ini
@ -6,15 +6,6 @@ envlist=
|
||||
py311-wheel-windows
|
||||
docs
|
||||
|
||||
[isort]
|
||||
combine_as_imports=True
|
||||
force_grid_wrap=1
|
||||
force_sort_within_sections=True
|
||||
known_third_party=hypothesis,pytest
|
||||
known_first_party=<MODULE_NAME>
|
||||
multi_line_output=3
|
||||
profile=black
|
||||
|
||||
[flake8]
|
||||
exclude=venv*,.tox,docs,build
|
||||
extend-ignore=E203
|
||||
|
||||
Reference in New Issue
Block a user