Skip to content

Commit d1ae3a0

Browse files
committed
various ruff updates
1 parent 971a9d6 commit d1ae3a0

File tree

5 files changed

+122
-88
lines changed

5 files changed

+122
-88
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.12.11
5+
hooks:
6+
# Run the linter.
7+
- id: ruff-check
8+
types_or: [ python, pyi ]
9+
args: [ --fix-only, --unsafe-fixes, --exit-non-zero-on-fix ]
10+
# Run the formatter.
11+
- id: ruff-format
212
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
13+
rev: v6.0.0
414
hooks:
515
- id: end-of-file-fixer
616
- id: trailing-whitespace
7-
- repo: https://github.com/charliermarsh/ruff-pre-commit
8-
rev: 'v0.6.4'
9-
hooks:
10-
- id: ruff
11-
args: [--fix, --exit-non-zero-on-fix]
1217
- repo: https://github.com/codespell-project/codespell
1318
# Configuration for codespell is in pyproject.toml
1419
rev: v2.4.1

.vscode/tasks.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,40 @@
199199
"clear": true
200200
},
201201
},
202+
{
203+
"label": "Ruff Statistics",
204+
"detail": "Displays the statistics of all the linting violations",
205+
"type": "shell",
206+
"problemMatcher": [],
207+
"command": "uv",
208+
"args": ["run", "ruff", "check", "--statistics"],
209+
"presentation":
210+
{
211+
"echo": true,
212+
"reveal": "always",
213+
"focus": false,
214+
"panel": "shared",
215+
"showReuseMessage": true,
216+
"clear": true
217+
},
218+
},
219+
{
220+
"label": "Ruff Lint Watch",
221+
"detail": "Runs the auto linter when files change",
222+
"type": "process",
223+
"problemMatcher": [],
224+
"command": "uv",
225+
"args": ["run", "ruff", "check", "--watch"],
226+
"presentation":
227+
{
228+
"echo": true,
229+
"reveal": "always",
230+
"focus": false,
231+
"panel": "shared",
232+
"showReuseMessage": true,
233+
"clear": true
234+
},
235+
},
202236
],
203237
"inputs":
204238
[

pyproject.toml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -111,66 +111,6 @@ markers = [
111111
[tool.black]
112112
line-length = 120
113113

114-
# Ruff
115-
116-
[tool.ruff]
117-
118-
src = ["appdaemon", "tests"]
119-
120-
# Exclude a variety of commonly ignored directories.
121-
exclude = [
122-
".bzr",
123-
".direnv",
124-
".eggs",
125-
".git",
126-
".hg",
127-
".mypy_cache",
128-
".nox",
129-
".pants.d",
130-
".pytype",
131-
".ruff_cache",
132-
".svn",
133-
".tox",
134-
".venv",
135-
".devenv",
136-
"__pypackages__",
137-
"_build",
138-
"buck-out",
139-
"build",
140-
"dist",
141-
"node_modules",
142-
"venv",
143-
]
144-
145-
line-length = 200
146-
indent-width = 4
147-
148-
# Assume Python 3.10.
149-
target-version = "py310"
150-
151-
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
152-
lint.select = ["E", "F"]
153-
lint.ignore = []
154-
155-
# Allow autofix for all enabled rules (when `--fix`) is provided.
156-
lint.fixable = ["E", "F", "UP"]
157-
# lint.fixable = ["ALL"]
158-
lint.unfixable = []
159-
160-
# Allow unused variables when underscore-prefixed.
161-
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
162-
163-
lint.per-file-ignores = {}
164-
165-
[tool.ruff.lint.mccabe]
166-
# Unlike Flake8, default to a complexity level of 10.
167-
max-complexity = 10
168-
169-
[tool.ruff.format]
170-
quote-style = "double"
171-
indent-style = "space"
172-
docstring-code-format = false
173-
174114
[tool.uv]
175115
dev-dependencies = [
176116
"build>=1.2.1",

ruff.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
src = ["appdaemon", "tests"]
2+
3+
# Exclude a variety of commonly ignored directories.
4+
exclude = [
5+
".bzr",
6+
".direnv",
7+
".eggs",
8+
".git",
9+
".hg",
10+
".mypy_cache",
11+
".nox",
12+
".pants.d",
13+
".pytype",
14+
".ruff_cache",
15+
".svn",
16+
".tox",
17+
".venv",
18+
".devenv",
19+
"__pypackages__",
20+
"_build",
21+
"buck-out",
22+
"build",
23+
"dist",
24+
"node_modules",
25+
"venv",
26+
]
27+
28+
line-length = 200
29+
indent-width = 4
30+
31+
# Assume Python 3.10.
32+
target-version = "py310"
33+
34+
[lint]
35+
extend-select = [
36+
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
37+
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
38+
"COM", # https://docs.astral.sh/ruff/rules/#flake8-commas-com
39+
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
40+
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
41+
"E", # https://docs.astral.sh/ruff/rules/#error-e
42+
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
43+
"FA", # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
44+
"FBT", # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
45+
"I", # https://docs.astral.sh/ruff/rules/#isort-i
46+
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
47+
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
48+
"PLE", # https://docs.astral.sh/ruff/rules/#error-ple
49+
"PLR", # https://docs.astral.sh/ruff/rules/#refactor-plr
50+
"PLW", # https://docs.astral.sh/ruff/rules/#warning-plw
51+
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
52+
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
53+
"PYI", # https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
54+
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
55+
"TID", # https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
56+
]
57+
extend-ignore = [
58+
"COM812",
59+
# "COM819", # https://docs.astral.sh/ruff/rules/prohibited-trailing-comma/
60+
]
61+
62+
# Allow autofix for all enabled rules (when `--fix`) is provided.
63+
fixable = ["ALL"]
64+
extend-unfixable = []
65+
66+
# Allow unused variables when underscore-prefixed.
67+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
68+
69+
per-file-ignores = {}
70+
71+
[lint.mccabe]
72+
max-complexity = 10
73+
74+
[format]
75+
quote-style = "double"
76+
indent-style = "space"
77+
docstring-code-format = true

tests/ruff.toml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)