Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 8 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,16 @@ repos:
args:
- '-d {extends: default, rules: {line-length: disable, document-start: disable}}'
- '-s'
- repo: 'https://github.com/MarcoGorelli/absolufy-imports'
rev: v0.3.1
- repo: 'https://github.com/astral-sh/ruff-pre-commit'
rev: v0.15.17
hooks:
- id: absolufy-imports
- repo: 'https://github.com/hadialqattan/pycln'
rev: v2.6.0
hooks:
- id: pycln
args:
- '--all'
- repo: 'https://github.com/pycqa/isort'
rev: 9.0.0a3
hooks:
- id: isort
- id: ruff-check
args:
- '--profile'
- black
- '--atomic'
- '--line-length'
- '99'
- '--python-version'
- '39'
- '--fix'
- id: ruff-check
alias: ruff-check-manual
stages:
- manual
- repo: 'https://github.com/psf/black'
rev: 26.5.1
hooks:
Expand All @@ -65,18 +53,6 @@ repos:
- '--target-version=py310'
- '--check'
- '--diff'
- repo: 'https://github.com/pycqa/flake8'
rev: 7.3.0
hooks:
- id: flake8
args:
- '--max-line-length=99'
- id: flake8
args:
- '--max-line-length=99'
alias: flake8-check
stages:
- manual
- repo: 'https://github.com/pre-commit/mirrors-mypy'
rev: v2.1.0
hooks:
Expand Down
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,27 @@ mypy: ## Runs mypy against staged changes for static type checking.
@\
pre-commit run --hook-stage manual mypy-check | grep -v "INFO"

.PHONY: flake8
flake8: ## Runs flake8 against staged changes to enforce style guide.
.PHONY: ruff
ruff: ## Runs ruff against staged changes to enforce style guide.
@\
pre-commit run --hook-stage manual flake8-check | grep -v "INFO"
pre-commit run --hook-stage manual ruff-check-manual | grep -v "INFO"

.PHONY: black
black: ## Runs black against staged changes to enforce style guide.
@\
pre-commit run --hook-stage manual black-check -v | grep -v "INFO"

.PHONY: lint
lint: ## Runs flake8 and mypy code checks against staged changes.
lint: ## Runs ruff and mypy code checks against staged changes.
@\
pre-commit run flake8-check --hook-stage manual | grep -v "INFO"; \
pre-commit run ruff-check-manual --hook-stage manual | grep -v "INFO"; \
pre-commit run mypy-check --hook-stage manual | grep -v "INFO"

.PHONY: all
all: ## Runs all checks against staged changes.
@\
pre-commit run -a

.PHONY: linecheck
linecheck: ## Checks for all Python lines 100 characters or more
@\
find dbt -type f -name "*.py" -exec grep -I -r -n '.\{100\}' {} \;

.PHONY: unit
unit: ## Runs unit tests.
@\
Expand All @@ -52,7 +47,7 @@ test: ## Runs unit tests and code checks against staged changes.
@\
pytest -n auto -ra -v tests/unit; \
pre-commit run black-check --hook-stage manual | grep -v "INFO"; \
pre-commit run flake8-check --hook-stage manual | grep -v "INFO"; \
pre-commit run ruff-check-manual --hook-stage manual | grep -v "INFO"; \
pre-commit run mypy-check --hook-stage manual | grep -v "INFO"

.PHONY: server
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,19 @@ namespaces = true

[tool.uv]
link-mode = "copy"

[tool.ruff]
line-length = 99
target-version = "py310"

[tool.ruff.lint]
# E/W = pycodestyle, F = pyflakes (together: flake8), I = isort,
# TID252 = no relative imports (absolufy-imports); unused-import
# removal (pycln) is F401, included in F
select = ["E", "F", "W", "I", "TID252"]

[tool.ruff.lint.isort]
known-first-party = ["dbt"]

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