Skip to content

Commit d709249

Browse files
authored
Merge pull request #707 from joshmarkovic/jm/ruff-lint-tooling
chore: consolidate isort, flake8, pycln and absolufy-imports into ruff
2 parents 10df88a + 9d20ad7 commit d709249

3 files changed

Lines changed: 30 additions & 43 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,16 @@ repos:
2727
args:
2828
- '-d {extends: default, rules: {line-length: disable, document-start: disable}}'
2929
- '-s'
30-
- repo: 'https://github.com/MarcoGorelli/absolufy-imports'
31-
rev: v0.3.1
30+
- repo: 'https://github.com/astral-sh/ruff-pre-commit'
31+
rev: v0.15.17
3232
hooks:
33-
- id: absolufy-imports
34-
- repo: 'https://github.com/hadialqattan/pycln'
35-
rev: v2.6.0
36-
hooks:
37-
- id: pycln
38-
args:
39-
- '--all'
40-
- repo: 'https://github.com/pycqa/isort'
41-
rev: 9.0.0a3
42-
hooks:
43-
- id: isort
33+
- id: ruff-check
4434
args:
45-
- '--profile'
46-
- black
47-
- '--atomic'
48-
- '--line-length'
49-
- '99'
50-
- '--python-version'
51-
- '39'
35+
- '--fix'
36+
- id: ruff-check
37+
alias: ruff-check-manual
38+
stages:
39+
- manual
5240
- repo: 'https://github.com/psf/black'
5341
rev: 26.5.1
5442
hooks:
@@ -65,18 +53,6 @@ repos:
6553
- '--target-version=py310'
6654
- '--check'
6755
- '--diff'
68-
- repo: 'https://github.com/pycqa/flake8'
69-
rev: 7.3.0
70-
hooks:
71-
- id: flake8
72-
args:
73-
- '--max-line-length=99'
74-
- id: flake8
75-
args:
76-
- '--max-line-length=99'
77-
alias: flake8-check
78-
stages:
79-
- manual
8056
- repo: 'https://github.com/pre-commit/mirrors-mypy'
8157
rev: v2.1.0
8258
hooks:

Makefile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,27 @@ mypy: ## Runs mypy against staged changes for static type checking.
1111
@\
1212
pre-commit run --hook-stage manual mypy-check | grep -v "INFO"
1313

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

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

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

3030
.PHONY: all
3131
all: ## Runs all checks against staged changes.
3232
@\
3333
pre-commit run -a
3434

35-
.PHONY: linecheck
36-
linecheck: ## Checks for all Python lines 100 characters or more
37-
@\
38-
find dbt -type f -name "*.py" -exec grep -I -r -n '.\{100\}' {} \;
39-
4035
.PHONY: unit
4136
unit: ## Runs unit tests.
4237
@\
@@ -52,7 +47,7 @@ test: ## Runs unit tests and code checks against staged changes.
5247
@\
5348
pytest -n auto -ra -v tests/unit; \
5449
pre-commit run black-check --hook-stage manual | grep -v "INFO"; \
55-
pre-commit run flake8-check --hook-stage manual | grep -v "INFO"; \
50+
pre-commit run ruff-check-manual --hook-stage manual | grep -v "INFO"; \
5651
pre-commit run mypy-check --hook-stage manual | grep -v "INFO"
5752

5853
.PHONY: server

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,19 @@ namespaces = true
9090

9191
[tool.uv]
9292
link-mode = "copy"
93+
94+
[tool.ruff]
95+
line-length = 99
96+
target-version = "py310"
97+
98+
[tool.ruff.lint]
99+
# E/W = pycodestyle, F = pyflakes (together: flake8), I = isort,
100+
# TID252 = no relative imports (absolufy-imports); unused-import
101+
# removal (pycln) is F401, included in F
102+
select = ["E", "F", "W", "I", "TID252"]
103+
104+
[tool.ruff.lint.isort]
105+
known-first-party = ["dbt"]
106+
107+
[tool.ruff.lint.flake8-tidy-imports]
108+
ban-relative-imports = "all"

0 commit comments

Comments
 (0)