Skip to content

Commit

Permalink
Bump deps and tools and fix CI (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Mar 3, 2023
1 parent 80d5c11 commit 6b69376
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ repos:
hooks:
- id: tox-ini-fmt
args: [ "-p", "fix" ]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.9.2"
hooks:
- id: pyproject-fmt
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.1.20
- flake8-bugbear==23.2.13
- flake8-comprehensions==3.10.1
- flake8-pytest-style==1.7
- flake8-pytest-style==1.7.2
- flake8-spellcheck==0.28
- flake8-unused-arguments==0.0.13
- flake8-noqa==1.3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Apply a consistent format to `pyproject.toml` files.

```yaml
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.9.0"
rev: "0.9.2"
hooks:
- id: pyproject-fmt
```
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [
]

[project]
name = "pyproject_fmt"
name = "pyproject-fmt"
description = "Format your pyproject.toml file"
readme = "README.md"
keywords = [
Expand All @@ -33,7 +33,7 @@ dynamic = [
dependencies = [
"packaging>=23",
"tomlkit>=0.11.6",
'typing-extensions>=4.4; python_version < "3.8"',
'typing-extensions>=4.5; python_version < "3.8"',
]
optional-dependencies.docs = [
"furo>=2022.12.7",
Expand All @@ -49,9 +49,9 @@ optional-dependencies.test = [
"pytest-mock>=3.10",
]
urls."Bug Tracker" = "https://github.com/tox-dev/pyproject-fmt/issues"
urls."Changelog" = "https://github.com/tox-dev/pyproject-fmt/releases"
urls.Documentation = "https://github.com/tox-dev/pyproject-fmt/"
urls."Source Code" = "https://github.com/tox-dev/pyproject-fmt"
urls."Changelog" = "https://github.com/tox-dev/pyproject-fmt/releases"
scripts.pyproject-fmt = "pyproject_fmt.__main__:run"

[tool.hatch]
Expand Down
4 changes: 2 additions & 2 deletions src/pyproject_fmt/formatter/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ def sorted_array(


def ensure_newline_at_end(body: Table) -> None:
content = body
content: Table = body
while True:
if isinstance(content, AoT) and content.value and isinstance(content[-1], (AoT, Table)):
content = content[-1]
elif isinstance(content, Table) and content.value.body and isinstance(content.value.body[-1][1], (AoT, Table)):
content = content.value.body[-1][1]
content = content.value.body[-1][1] # type: ignore # can be AoT temporarily
else: # pragma: no cover
# coverage has a bug on python < 3.10, seeing this line as uncovered
# https://github.com/nedbat/coveragepy/issues/1480
Expand Down
2 changes: 0 additions & 2 deletions tests/formatter/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def test_sub_table_newline(fmt: Fmt) -> None:
content = """
[tool.mypy]
a = 0
[[tool.mypy.overrides]]
a = 1
[tool.something-else]
Expand All @@ -63,7 +62,6 @@ def test_sub_table_newline(fmt: Fmt) -> None:
expected = """
[tool.mypy]
a = 0
[[tool.mypy.overrides]]
a = 1
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ wheel_build_env = .pkg
description = run static analysis and style check using flake8
skip_install = true
deps =
pre-commit>=3.0.4
pre-commit>=3.1.1
commands =
pre-commit run --all-files --show-diff-on-failure
python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
Expand All @@ -46,7 +46,8 @@ setenv =
deps =
mypy==1
commands =
mypy --strict --python-version 3.10 src tests
mypy src
mypy tests

[testenv:readme]
description = check that the long description is valid
Expand Down

0 comments on commit 6b69376

Please sign in to comment.