Skip to content

Commit

Permalink
Ruff: Add and fix PTH113
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer committed Nov 6, 2024
1 parent 1659350 commit 8deaddf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dojo/settings/.settings.dist.py.sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6b9365d002880ae64ab54da905ede076db5a8661960f8f1e2793b7f4d25ff7e8
9860316f077ad0fea78686f7a30cc9088eadf303f79348d1185f6bce77765703
3 changes: 2 additions & 1 deletion dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import warnings
from datetime import timedelta
from email.utils import getaddresses
from pathlib import Path

import environ
from celery.schedules import crontab
Expand Down Expand Up @@ -332,7 +333,7 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param


# Read .env file as default or from the command line, DD_ENV_PATH
if os.path.isfile(root("dojo/settings/.env.prod")) or "DD_ENV_PATH" in os.environ:
if Path.is_file(root("dojo/settings/.env.prod")) or "DD_ENV_PATH" in os.environ:
env.read_env(root("dojo/settings/" + env.str("DD_ENV_PATH", ".env.prod")))

# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ select = [
"TCH",
"INT",
"ARG003", "ARG004", "ARG005",
"PTH2", "PTH101", "PTH102", "PTH103", "PTH104", "PTH105", "PTH106", "PTH107", "PTH108", "PTH109", "PTH110", "PTH111", "PTH114", "PTH115", "PTH116", "PTH117", "PTH119", "PTH121", "PTH124",
"PTH2", "PTH101", "PTH102", "PTH103", "PTH104", "PTH105", "PTH106", "PTH107", "PTH108", "PTH109", "PTH110", "PTH111", "PTH113", "PTH114", "PTH115", "PTH116", "PTH117", "PTH119", "PTH121", "PTH124",
"TD001", "TD004", "TD005",
"PD",
"PGH",
Expand Down
8 changes: 4 additions & 4 deletions unittests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_file_existence(self):
with self.subTest(parser=parser_dir.name, category="docs"):
doc_file = os.path.join(basedir, "docs", "content", "en", "integrations", "parsers", category, f"{doc_name}.md")
self.assertTrue(
os.path.isfile(doc_file),
Path.is_file(doc_file),
f"Documentation file '{doc_file}' is missing or using different name",
)

Expand All @@ -55,7 +55,7 @@ def test_file_existence(self):
with self.subTest(parser=parser_dir.name, category="parser"):
parser_test_file = os.path.join(basedir, "unittests", "tools", f"test_{parser_dir.name}_parser.py")
self.assertTrue(
os.path.isfile(parser_test_file),
Path.is_file(parser_test_file),
f"Unittest of parser '{parser_test_file}' is missing or using different name",
)

Expand All @@ -78,7 +78,7 @@ def test_file_existence(self):
with self.subTest(parser=parser_dir.name, category="importer"):
importer_test_file = os.path.join(basedir, "unittests", "tools", f"test_{parser_dir.name}_importer.py")
self.assertTrue(
os.path.isfile(importer_test_file),
Path.is_file(importer_test_file),
f"Unittest of importer '{importer_test_file}' is missing or using different name",
)
for file in os.scandir(os.path.join(basedir, "dojo", "tools", parser_dir.name)):
Expand Down Expand Up @@ -110,6 +110,6 @@ def test_parser_existence(self):
with self.subTest(parser=docs.name.split(".md")[0], category="parser"):
parser = os.path.join(basedir, "dojo", "tools", f"{docs.name.split('.md')[0]}", "parser.py")
self.assertTrue(
os.path.isfile(parser),
path.is_file(parser),

Check failure on line 113 in unittests/test_parsers.py

View workflow job for this annotation

GitHub Actions / ruff-linting

Ruff (F821)

unittests/test_parsers.py:113:25: F821 Undefined name `path`
f"Parser '{parser}' is missing or using different name",
)

0 comments on commit 8deaddf

Please sign in to comment.