Skip to content

Commit

Permalink
style: update ruff settings
Browse files Browse the repository at this point in the history
* chore: add config for `toml` formatter
* chore: remove unnecessary `shebang` in python files
* ci(pre-commit): update `poetry-check` hook args
* ci(pre-commit): update `ruff-pre-commit` hook to `0.2.0`
  • Loading branch information
DeadNews committed Feb 2, 2024
1 parent 7953eeb commit c1a74cc
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 18 deletions.
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
- id: checkmake

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
rev: v0.2.0
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -59,8 +59,7 @@ repos:
rev: 1.7.1
hooks:
- id: poetry-check
- id: poetry-lock
args: [--check]
args: [--lock]

- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
Expand Down
2 changes: 2 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[formatting]
allowed_blank_lines = 1
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"charliermarsh.ruff",
"ms-python.mypy-type-checker",
"ms-python.python"
"ms-python.python",
"tamasfe.even-better-toml"
]
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pc-install:
update-latest:
poetry up --latest

checks: pc-run lint test
checks: pc-run install lint pyright test

pc-run:
pre-commit run -a
Expand Down
13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,22 @@ ignore = [
"COM812", # Trailing comma missing
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
"E501", # Line too long
"EXE001", # Shebang is present but file is not executable
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
"ISC001", # Checks for implicitly concatenated strings on a single line.
"ISC001", # Checks for implicitly concatenated strings on a single line
"PLR0913", # Too many arguments to function call
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/*" = ["ANN", "D", "PLC1901", "PLR2004", "S"]
"tests/*" = ["ANN", "D", "E501", "PLC1901", "PLR2004", "S"]

[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.pycodestyle]
max-doc-length = 129
max-line-length = 129

[tool.ruff.lint.pydocstyle]
convention = "google"
1 change: 0 additions & 1 deletion src/deadnews_template_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#!/usr/bin/env python
"""Public accessible objects of that module."""
1 change: 0 additions & 1 deletion src/deadnews_template_python/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
"""Entrypoint for app, enables execution with `python -m deadnews_template_python`."""
import uvicorn

Expand Down
1 change: 0 additions & 1 deletion src/deadnews_template_python/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
"""Minimal FastAPI application."""
from fastapi import FastAPI, HTTPException

Expand Down
1 change: 0 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
#!/usr/bin/env python
1 change: 0 additions & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
import random
from typing import TYPE_CHECKING

Expand Down
1 change: 0 additions & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
from deadnews_template_python.__main__ import main


Expand Down

0 comments on commit c1a74cc

Please sign in to comment.