Skip to content

Commit

Permalink
fix: support more common tools (#149)
Browse files Browse the repository at this point in the history
* fix: support more common tools

Signed-off-by: Henry Schreiner <[email protected]>

* fix: address review comments

Signed-off-by: Henry Schreiner <[email protected]>

---------

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Nov 1, 2023
1 parent 37dd59e commit ba214ba
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/pyproject_fmt/formatter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,32 @@ def fmt_tools(parsed: TOMLDocument, conf: Config) -> None: # noqa: ARG001
table = tools[tool]
ensure_newline_at_end(cast(Table, table))
order = [
# Build backends
"poetry",
"setuptools",
"distutils",
"setuptools_scm",
"hatch",
"flit",
"scikit-build",
"meson-python",
# Builders
"cibuildwheel",
# Formatters and linters
"autopep8",
"black",
"ruff",
"isort",
"flake8",
"pylint",
"repo-review",
"codespell",
"docformatter",
# Testing
"pytest",
"pytest_env",
"coverage",
# Type checking
"mypy",
]
order_keys(tools, to_pin=order)
Expand Down
40 changes: 39 additions & 1 deletion tests/formatter/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def test_tools_ordering(fmt: Fmt) -> None:
a = 0
[tool.poetry.scripts]
version = "1"
[tool.scikit-build]
a = 0
[tool.pytest]
a = 0
[tool.black]
Expand All @@ -29,9 +31,21 @@ def test_tools_ordering(fmt: Fmt) -> None:
a = 0
[tool.setuptools]
a.b = 0
[tool.docformatter]
c = 0
[tool.autopep8]
a = 0
[tool.distutils]
a = 0
[tool.codespell]
[tool.meson-python]
a = 0
[tool.cibuildwheel]
a = 0
[tool.pylint]
[tool.repo-review]
a = 0
[tool.flit]
"""
expected = """
[tool.poetry]
Expand All @@ -41,12 +55,26 @@ def test_tools_ordering(fmt: Fmt) -> None:
[tool.setuptools]
a.b = 0
[tool.distutils]
a = 0
[tool.setuptools_scm]
a = 0
[tool.hatch]
a = 0
[tool.flit]
[tool.scikit-build]
a = 0
[tool.meson-python]
a = 0
[tool.cibuildwheel]
a = 0
[tool.autopep8]
a = 0
Expand All @@ -58,6 +86,16 @@ def test_tools_ordering(fmt: Fmt) -> None:
[tool.flake8]
[tool.pylint]
[tool.repo-review]
a = 0
[tool.codespell]
[tool.docformatter]
c = 0
[tool.pytest]
a = 0
Expand Down

0 comments on commit ba214ba

Please sign in to comment.