Skip to content

Commit

Permalink
chore: add literal_eval check
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Aug 22, 2023
1 parent 4903898 commit d836529
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/ext/conftabs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import ast
import textwrap

from docutils import nodes
Expand All @@ -14,7 +15,7 @@ class ConfTabs(SphinxDirective):
def run(self):
name, result = self.arguments
env_name = f"SKBUILD_{name.replace('.', '_').upper()}"
value_result = eval(result, {}, {}) # noqa: PGH001
value_result = ast.literal_eval(result)
if isinstance(value_result, list):
joined_result = ";".join(value_result)
elif isinstance(value_result, bool):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ select = [
"UP", # pyupgrade
"YTT", # flake8-2020
"ANN204", # Add -> None to __init__
"S307", # eval -> literal_eval
]
extend-ignore = [
"PLR", # Design rules for pylint
Expand Down

0 comments on commit d836529

Please sign in to comment.