Skip to content

Commit

Permalink
feat: add linting
Browse files Browse the repository at this point in the history
  • Loading branch information
aleneum committed Dec 11, 2024
1 parent 9b4ca18 commit e80849a
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default_language_version:
python: python3.12

repos:
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
hooks:
- id: actionlint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
hooks:
- id: ruff-format
- id: ruff
49 changes: 47 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,64 @@ dependencies = [
"poethepoet>=0.31.1",
"pydantic-settings>=2.4.0",
"python-dotenv>=1.0.1",
"ruff>=0.6.4",
]

[dependency-groups]
dev = ["pytest>=8.3.3", "ruff>=0.6.4"]
dev = [
"mypy>=1.13.0",
"pre-commit-hooks>=5.0.0",
"pytest>=8.3.3",
"ruff>=0.6.4",
"types-docker>=7.1.0.20240827",
"types-pyyaml>=6.0.12.20240917",
]

[tool.poe.tasks]
prod.script = "hive_cli.server:prod()"
dev = "uv run dev.py"
lint = "uv run mypy hive_cli"
test = "uv run pytest tests"

# Without build system declaration the package cannot be imported
# https://github.com/astral-sh/uv/issues/9291
# https://github.com/astral-sh/uv/issues/1626
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.ruff.lint]
# 1. Enable flake8-bugbear (`B`) rules, in addition to the defaults.
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort (imports) styling
"N", # pep8 naming checks
"B", # bugbear checks
"ANN", # type annotations
"S", # bandid code security
"C", # improve code comprehension
"EM", # use recommended error message composition
"G", # use recommended logging format
"T20", # no print allowed
"PT", # pytest styling recommendations
"SLF", # prevent access to private members
"SIM", # code simplification recommendations
"TCH", # checks for type checking imports
"ARG", # no unused arguments
"PERF", # performance anti pattern
# "FURB", # enforces modern python
# "D", # enforce documented functions [will be enabled soon]
]

ignore = [
"ANN101"
]

# 2. Fix everything except flake8-bugbear (`B`) violations.
fixable = ["ALL"]
unfixable = ["B"]

# 3. Things to ignore
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"] # assert is fine in pytest

0 comments on commit e80849a

Please sign in to comment.