Skip to content

Commit

Permalink
fix: add more tools (#154)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Nov 9, 2023
1 parent 6346378 commit cbdbeea
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pyproject_fmt/formatter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ def fmt_tools(parsed: TOMLDocument, conf: Config) -> None: # noqa: ARG001
order = [
# Build backends
"poetry",
"pdm",
"setuptools",
"distutils",
"setuptools_scm",
"hatch",
"flit",
"scikit-build",
"meson-python",
"maturin",
"whey",
"py-build-cmake",
"sphinx-theme-builder",
# Builders
"cibuildwheel",
# Formatters and linters
Expand All @@ -44,16 +49,35 @@ def fmt_tools(parsed: TOMLDocument, conf: Config) -> None: # noqa: ARG001
"ruff",
"isort",
"flake8",
"pycln",
"nbqa",
"pylint",
"repo-review",
"codespell",
"docformatter",
"pydoclint",
"tomlsort",
"check-manifest",
"check-sdist",
"check-wheel-contents",
# Testing
"pytest",
"pytest_env",
"pytest-enabler",
"coverage",
# Runners
"doit",
"spin",
"tox",
# Releasers/bumpers
"bumpversion",
"jupyter-releaser",
"tbump",
"towncrier",
"vendoring",
# Type checking
"mypy",
"pyright",
]
order_keys(tools, to_pin=order)

Expand Down
72 changes: 72 additions & 0 deletions tests/formatter/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,39 @@ def test_tools_ordering(fmt: Fmt) -> None:
[tool.pylint]
[tool.repo-review]
a = 0
[tool.bumpversion]
[tool.check-manifest]
[tool.check-sdist]
[tool.check-wheel-contents]
[tool.doit]
[tool.flit]
[tool.jupyter-releaser]
[tool.maturin]
[tool.mypy]
[tool.nbqa]
[tool.pdm]
[tool.py-build-cmake]
[tool.pycln]
[tool.pydoclint]
[tool.pyright]
[tool.pytest-enabler]
[tool.pytest_env]
[tool.sphinx-theme-builder]
[tool.spin]
[tool.tbump]
[tool.tomlsort]
[tool.towncrier]
[tool.tox]
[tool.vendoring]
[tool.whey]
"""
expected = """
[tool.poetry]
name = "a"
[tool.poetry.scripts]
version = "1"
[tool.pdm]
[tool.setuptools]
a.b = 0
Expand All @@ -72,6 +98,14 @@ def test_tools_ordering(fmt: Fmt) -> None:
[tool.meson-python]
a = 0
[tool.maturin]
[tool.whey]
[tool.py-build-cmake]
[tool.sphinx-theme-builder]
[tool.cibuildwheel]
a = 0
Expand All @@ -86,6 +120,10 @@ def test_tools_ordering(fmt: Fmt) -> None:
[tool.flake8]
[tool.pycln]
[tool.nbqa]
[tool.pylint]
[tool.repo-review]
Expand All @@ -96,11 +134,45 @@ def test_tools_ordering(fmt: Fmt) -> None:
[tool.docformatter]
c = 0
[tool.pydoclint]
[tool.tomlsort]
[tool.check-manifest]
[tool.check-sdist]
[tool.check-wheel-contents]
[tool.pytest]
a = 0
[tool.pytest_env]
[tool.pytest-enabler]
[tool.coverage]
a = 0
[tool.doit]
[tool.spin]
[tool.tox]
[tool.bumpversion]
[tool.jupyter-releaser]
[tool.tbump]
[tool.towncrier]
[tool.vendoring]
[tool.mypy]
[tool.pyright]
"""
fmt(fmt_tools, content, expected)

Expand Down

0 comments on commit cbdbeea

Please sign in to comment.