Skip to content

Commit 3085ffd

Browse files
Use ruff (#189)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 1ac7baa commit 3085ffd

19 files changed

+248
-316
lines changed

.markdownlint.yaml

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

.pre-commit-config.yaml

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,17 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v4.4.0
44
hooks:
5-
- id: check-ast
6-
- id: check-builtin-literals
7-
- id: check-docstring-first
8-
- id: check-merge-conflict
9-
- id: check-yaml
10-
- id: check-toml
11-
- id: debug-statements
125
- id: end-of-file-fixer
136
- id: trailing-whitespace
14-
- repo: https://github.com/asottile/add-trailing-comma
15-
rev: v2.4.0
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: "v0.0.272"
169
hooks:
17-
- id: add-trailing-comma
18-
args: [--py36-plus]
19-
- repo: https://github.com/asottile/pyupgrade
20-
rev: v3.4.0
21-
hooks:
22-
- id: pyupgrade
23-
args: ["--py37-plus"]
24-
- repo: https://github.com/PyCQA/isort
25-
rev: 5.12.0
26-
hooks:
27-
- id: isort
10+
- id: ruff
11+
args: [--fix, --exit-non-zero-on-fix]
2812
- repo: https://github.com/psf/black
2913
rev: 23.3.0
3014
hooks:
3115
- id: black
32-
args: [--safe]
33-
- repo: https://github.com/asottile/blacken-docs
34-
rev: 1.13.0
35-
hooks:
36-
- id: blacken-docs
37-
additional_dependencies: [black==23.3]
38-
- repo: https://github.com/pre-commit/pygrep-hooks
39-
rev: v1.10.0
40-
hooks:
41-
- id: rst-backticks
4216
- repo: https://github.com/tox-dev/tox-ini-fmt
4317
rev: "1.3.0"
4418
hooks:
@@ -48,32 +22,11 @@ repos:
4822
rev: "0.11.2"
4923
hooks:
5024
- id: pyproject-fmt
51-
additional_dependencies: [tox>=4.5.1]
52-
- repo: https://github.com/PyCQA/flake8
53-
rev: 6.0.0
54-
hooks:
55-
- id: flake8
56-
additional_dependencies:
57-
- flake8-bugbear==23.3.23
58-
- flake8-comprehensions==3.12
59-
- flake8-pytest-style==1.7.2
60-
- flake8-spellcheck==0.28
61-
- flake8-unused-arguments==0.0.13
62-
- flake8-noqa==1.3.1
63-
- pep8-naming==0.13.3
64-
- flake8-pyproject==1.2.3
6525
- repo: https://github.com/pre-commit/mirrors-prettier
66-
rev: "v2.7.1"
26+
rev: "v3.0.0-alpha.9-for-vscode"
6727
hooks:
6828
- id: prettier
69-
additional_dependencies:
70-
71-
- "@prettier/[email protected]"
7229
args: ["--print-width=120", "--prose-wrap=always"]
73-
- repo: https://github.com/igorshubovych/markdownlint-cli
74-
rev: v0.34.0
75-
hooks:
76-
- id: markdownlint
7730
- repo: meta
7831
hooks:
7932
- id: check-hooks-apply

codecov.yml

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

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
# noqa: INP001
2+
"""Configuration for Sphinx."""
13
from __future__ import annotations
24

3-
from datetime import datetime
5+
from datetime import datetime, timezone
46

57
from platformdirs.version import __version__
68

79
author = "The platformdirs team"
810
project = "platformdirs"
9-
copyright = "2021, The platformdirs team"
11+
copyright = "2021, The platformdirs team" # noqa: A001
1012

1113
release = __version__
1214
version = release
@@ -18,7 +20,7 @@
1820
"sphinx_autodoc_typehints",
1921
]
2022
html_theme = "furo"
21-
html_title, html_last_updated_fmt = "platformdirs", datetime.now().isoformat()
23+
html_title, html_last_updated_fmt = "platformdirs", datetime.now(tz=timezone.utc).isoformat()
2224
pygments_style, pygments_dark_style = "sphinx", "monokai"
2325
autoclass_content, autodoc_member_order, autodoc_typehints = "class", "bysource", "none"
2426
autodoc_default_options = {

pyproject.toml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
build-backend = "hatchling.build"
33
requires = [
44
"hatch-vcs>=0.3",
5-
"hatchling>=1.14.1",
5+
"hatchling>=1.17",
66
]
77

88
[project]
@@ -37,7 +37,6 @@ classifiers = [
3737
"Programming Language :: Python :: 3.9",
3838
"Programming Language :: Python :: 3.10",
3939
"Programming Language :: Python :: 3.11",
40-
"Programming Language :: Python :: 3.12",
4140
"Programming Language :: Python :: Implementation :: CPython",
4241
"Programming Language :: Python :: Implementation :: PyPy",
4342
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -46,19 +45,19 @@ dynamic = [
4645
"version",
4746
]
4847
dependencies = [
49-
'typing-extensions>=4.5; python_version < "3.8"',
48+
'typing-extensions>=4.6.3; python_version < "3.8"',
5049
]
5150
optional-dependencies.docs = [
52-
"furo>=2023.3.27",
51+
"furo>=2023.5.20",
5352
"proselint>=0.13",
54-
"sphinx>=6.2.1",
53+
"sphinx>=7.0.1",
5554
"sphinx-autodoc-typehints!=1.23.4,>=1.23",
5655
]
5756
optional-dependencies.test = [
5857
"appdirs==1.4.4",
5958
"covdefaults>=2.3",
6059
"pytest>=7.3.1",
61-
"pytest-cov>=4",
60+
"pytest-cov>=4.1",
6261
"pytest-mock>=3.10",
6362
]
6463
urls.Documentation = "https://platformdirs.readthedocs.io"
@@ -74,17 +73,6 @@ version.source = "vcs"
7473
[tool.black]
7574
line-length = 120
7675

77-
[tool.isort]
78-
profile = "black"
79-
known_first_party = ["platformdirs"]
80-
81-
[tool.flake8]
82-
max-complexity = 22
83-
max-line-length = 120
84-
unused-arguments-ignore-abstract-functions = true
85-
noqa-require-code = true
86-
dictionaries = ["en_US", "python", "technical", "django"]
87-
8876
[tool.coverage]
8977
html.show_contexts = true
9078
html.skip_covered = false
@@ -100,5 +88,26 @@ show_error_codes = true
10088
strict = true
10189
overrides = [{ module = ["appdirs.*", "jnius.*"], ignore_missing_imports = true }]
10290

103-
[tool.pep8]
104-
max-line-length = "120"
91+
[tool.ruff]
92+
select = ["ALL"]
93+
line-length = 120
94+
target-version = "py37"
95+
isort = {known-first-party = ["platformdirs", "tests"], required-imports = ["from __future__ import annotations"]}
96+
ignore = [
97+
"ANN101", # Missing type annotation for `self` in method
98+
"D301", # Use `r"""` if any backslashes in a docstring
99+
"D205", # 1 blank line required between summary line and description
100+
"D401", # First line of docstring should be in imperative mood
101+
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
102+
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
103+
"S104", # Possible binding to all interface
104+
]
105+
[tool.ruff.per-file-ignores]
106+
"tests/**/*.py" = [
107+
"S101", # asserts allowed in tests...
108+
"FBT", # don"t care about booleans as positional arguments in tests
109+
"INP001", # no implicit namespace
110+
"D", # don"t care about documentation in tests
111+
"S603", # `subprocess` call: check for execution of untrusted input
112+
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
113+
]

0 commit comments

Comments
 (0)