mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Enable Ruff's pygrep-hooks checks
This commit is contained in:
parent
6a132eba5a
commit
b89c33fc0a
@ -157,6 +157,8 @@ ignore = [
|
||||
# flake8-bugbear opinionated (disabled by default in flake8)
|
||||
'B904',
|
||||
'B905',
|
||||
# pygrep-hooks
|
||||
"PGH003",
|
||||
]
|
||||
external = [ # Whitelist for RUF100 unkown code warnings
|
||||
"E704",
|
||||
@ -170,8 +172,9 @@ select = [
|
||||
# plugins:
|
||||
"B", # flake8-bugbear
|
||||
"C4", # flake8-comprehensions
|
||||
"PGH", # pygrep-hooks
|
||||
"SIM", # flake8-simplify
|
||||
"RUF100" # yesqa
|
||||
"RUF100", # yesqa
|
||||
]
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
|
@ -383,7 +383,7 @@ Doctest summary
|
||||
context: Dict[str, Any] = {}
|
||||
if self.config.doctest_global_setup:
|
||||
exec(self.config.doctest_global_setup, context)
|
||||
should_skip = eval(condition, context)
|
||||
should_skip = eval(condition, context) # NoQA: PGH001
|
||||
if self.config.doctest_global_cleanup:
|
||||
exec(self.config.doctest_global_cleanup, context)
|
||||
return should_skip
|
||||
|
@ -53,7 +53,7 @@ def process_ifconfig_nodes(app: Sphinx, doctree: nodes.document, docname: str) -
|
||||
ns['builder'] = app.builder.name
|
||||
for node in list(doctree.findall(ifconfig)):
|
||||
try:
|
||||
res = eval(node['expr'], ns)
|
||||
res = eval(node['expr'], ns) # NoQA: PGH001
|
||||
except Exception as err:
|
||||
# handle exceptions in a clean fashion
|
||||
from traceback import format_exception_only
|
||||
|
@ -51,7 +51,7 @@ def encode_string(s: str) -> str:
|
||||
|
||||
|
||||
def decode_string(s: str) -> str:
|
||||
return ESCAPED.sub(lambda m: eval('"' + m.group() + '"'), s)
|
||||
return ESCAPED.sub(lambda m: eval('"' + m.group() + '"'), s) # NoQA: PGH001
|
||||
|
||||
|
||||
reswords = set("""\
|
||||
|
Loading…
Reference in New Issue
Block a user