Skip to content

Commit aff9578

Browse files
Upgrade Ruff configuration for v0.2.0 (sphinx-doc#11927)
Co-authored-by: Adam Turner <[email protected]>
1 parent fa29004 commit aff9578

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: python -m pip install --upgrade pip
3030

3131
- name: Install Ruff
32-
run: python -m pip install "ruff==0.1.14"
32+
run: python -m pip install "ruff==0.2.0"
3333

3434
- name: Lint with Ruff
3535
run: ruff . --output-format github

.ruff.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
target-version = "py39" # Pin Ruff to Python 3.9
22
line-length = 95
3-
required-version = "0.1.14"
4-
show-source = true
3+
required-version = "0.2.0"
4+
output-format = "full"
55

66
[lint]
77
preview = true
@@ -36,8 +36,6 @@ select = [
3636
"ANN001", # Missing type annotation for function argument `{name}`
3737
"ANN002", # Missing type annotation for `*{name}`
3838
"ANN003", # Missing type annotation for `**{name}`
39-
# "ANN101", # Missing type annotation for `{name}` in method
40-
"ANN102", # Missing type annotation for `{name}` in classmethod
4139
"ANN201", # Missing return type annotation for public function `{name}`
4240
"ANN202", # Missing return type annotation for private function `{name}`
4341
# "ANN204", # Missing return type annotation for special method `{name}`
@@ -101,7 +99,7 @@ select = [
10199
"D410", # Missing blank line after section ("{name}")
102100
"D411", # Missing blank line before section ("{name}")
103101
# "D412", # No blank lines allowed between a section header and its content ("{name}")
104-
"D413", # Missing blank line after last section ("{name}")
102+
# "D413", # Missing blank line after last section ("{name}")
105103
"D414", # Section has no content ("{name}")
106104
# "D415", # First line should end with a period, question mark, or exclamation point
107105
"D416", # Section name should end with a colon ("{name}")
@@ -296,7 +294,6 @@ select = [
296294
"RUF008", # Do not use mutable default values for dataclass attributes
297295
"RUF009", # Do not perform function call `{name}` in dataclass defaults
298296
"RUF010", # Use explicit conversion flag
299-
"RUF011", # Dictionary comprehension uses static key: `{key}`
300297
# "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
301298
"RUF013", # PEP 484 prohibits implicit `Optional`
302299
# "RUF015", # Prefer `next({iterable})` over single element slice
@@ -325,7 +322,7 @@ select = [
325322
"S304", # Use of insecure cipher, replace with a known secure cipher such as AES
326323
"S305", # Use of insecure cipher mode, replace with a known secure cipher such as AES
327324
"S306", # Use of insecure and deprecated function (`mktemp`)
328-
# "S307", # Use of possibly insecure function; consider using `ast.literal_eval`
325+
"S307", # Use of possibly insecure function; consider using `ast.literal_eval`
329326
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
330327
"S310", # Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
331328
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
@@ -402,7 +399,7 @@ select = [
402399
"TCH003", # Move standard library import `{}` into a type-checking block
403400
"TCH004", # Move import `{qualified_name}` out of type-checking block. Import is used for more than type hinting.
404401
"TCH005", # Found empty type-checking block
405-
"TCH006", # Invalid string member in `X | Y`-style union type
402+
"TCH010", # Invalid string member in `X | Y`-style union type
406403
# flake8-todos ('TD')
407404
# "TD001", # Invalid TODO tag: `{tag}`
408405
# "TD003", # Missing issue link on the line following this TODO

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ docs = [
8282
]
8383
lint = [
8484
"flake8>=3.5.0",
85-
"ruff==0.1.14",
85+
"ruff==0.2.0",
8686
"mypy==1.8.0",
8787
"sphinx-lint",
8888
"docutils-stubs",

sphinx/ext/doctest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def skipped(self, node: Element) -> bool:
395395
context: dict[str, Any] = {}
396396
if self.config.doctest_global_setup:
397397
exec(self.config.doctest_global_setup, context) # NoQA: S102
398-
should_skip = eval(condition, context) # NoQA: PGH001
398+
should_skip = eval(condition, context) # NoQA: S307
399399
if self.config.doctest_global_cleanup:
400400
exec(self.config.doctest_global_cleanup, context) # NoQA: S102
401401
return should_skip

sphinx/ext/ifconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def process_ifconfig_nodes(app: Sphinx, doctree: nodes.document, docname: str) -
5858
ns['builder'] = app.builder.name
5959
for node in list(doctree.findall(ifconfig)):
6060
try:
61-
res = eval(node['expr'], ns) # NoQA: PGH001
61+
res = eval(node['expr'], ns) # NoQA: S307
6262
except Exception as err:
6363
# handle exceptions in a clean fashion
6464
from traceback import format_exception_only

0 commit comments

Comments
 (0)