Skip to content

Commit 286f9e8

Browse files
committed
update precommit and ruff settings
1 parent 2b71e5f commit 286f9e8

File tree

3 files changed

+73
-33
lines changed

3 files changed

+73
-33
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
repos:
2-
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
4-
hooks:
5-
- id: trailing-whitespace
6-
exclude: ^weekly/
7-
- id: check-yaml
8-
- id: check-json
9-
- id: trailing-whitespace
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: trailing-whitespace
6+
exclude: ^weekly/
7+
- id: check-yaml
8+
- id: check-json
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
1011
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
# Ruff version.
1212
rev: v0.7.4
1313
hooks:
14-
# Run the linter.
1514
- id: ruff
16-
args: [ --fix ]
15+
args: ["check", "--select", "I", "--fix"]
1716
- id: ruff-format

dou/cli.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
PYPROJECT_TOML_CONTENT = """
1313
[tool.ruff]
14-
# Exclude commonly ignored directories.
1514
exclude = [
1615
".bzr",
1716
".direnv",
@@ -39,48 +38,42 @@
3938
"site-packages",
4039
"venv",
4140
]
42-
43-
# Same as Black.
4441
line-length = 88
45-
indent-width = 4
42+
indent-width=4
43+
target-version = "py311"
4644
4745
[tool.ruff.lint]
46+
extend-select = ["I", "U"]
4847
select = ["E4", "E7", "E9", "F"]
4948
ignore = []
50-
5149
fixable = ["ALL"]
5250
unfixable = []
53-
5451
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
5552
5653
[tool.ruff.format]
5754
quote-style = "double"
5855
indent-style = "space"
5956
skip-magic-trailing-comma = false
6057
line-ending = "auto"
61-
docstring-code-format = false
58+
docstring-code-format = true
6259
docstring-code-line-length = "dynamic"
63-
64-
[dependency-groups]
65-
dev = ["pre-commit>=4.0.1", "ruff>=0.8.1"]
6660
"""
6761
PRE_COMMIT_CONFIG_CONTENT = """
6862
repos:
69-
- repo: https://github.com/pre-commit/pre-commit-hooks
70-
rev: v4.6.0
71-
hooks:
72-
- id: trailing-whitespace
73-
exclude: ^weekly/
74-
- id: check-yaml
75-
- id: check-json
76-
- id: trailing-whitespace
63+
- repo: https://github.com/pre-commit/pre-commit-hooks
64+
rev: v4.6.0
65+
hooks:
66+
- id: trailing-whitespace
67+
exclude: ^weekly/
68+
- id: check-yaml
69+
- id: check-json
70+
- id: end-of-file-fixer
71+
- id: trailing-whitespace
7772
- repo: https://github.com/astral-sh/ruff-pre-commit
78-
# Ruff version.
7973
rev: v0.7.4
8074
hooks:
81-
# Run the linter.
8275
- id: ruff
83-
args: [ --fix ]
76+
args: ["check", "--select", "I", "--fix"]
8477
- id: ruff-format
8578
"""
8679

pyproject.toml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dou-utils"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
description = "The utility package of Dou Inc."
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -29,3 +29,51 @@ dev = [
2929
"setuptools>=75.6.0",
3030
"wheel>=0.45.1",
3131
]
32+
33+
[tool.ruff]
34+
exclude = [
35+
".bzr",
36+
".direnv",
37+
".eggs",
38+
".git",
39+
".hg",
40+
".ipynb_checkpoints",
41+
".mypy_cache",
42+
".nox",
43+
".pants.d",
44+
".pyenv",
45+
".pytest_cache",
46+
".pytype",
47+
".ruff_cache",
48+
".svn",
49+
".tox",
50+
".venv",
51+
".vscode",
52+
"__pypackages__",
53+
"_build",
54+
"buck-out",
55+
"build",
56+
"dist",
57+
"node_modules",
58+
"site-packages",
59+
"venv",
60+
]
61+
line-length = 88
62+
indent-width = 4
63+
target-version = "py311"
64+
65+
[tool.ruff.lint]
66+
extend-select = ["I", "U"]
67+
select = ["E4", "E7", "E9", "F"]
68+
ignore = []
69+
fixable = ["ALL"]
70+
unfixable = []
71+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
72+
73+
[tool.ruff.format]
74+
quote-style = "double"
75+
indent-style = "space"
76+
skip-magic-trailing-comma = false
77+
line-ending = "auto"
78+
docstring-code-format = true
79+
docstring-code-line-length = "dynamic"

0 commit comments

Comments
 (0)