From 7af6abe8eb01fcffd1e36b430cc963ebb0f63b4a Mon Sep 17 00:00:00 2001 From: Manuel Sommer Date: Tue, 5 Nov 2024 12:20:21 +0100 Subject: [PATCH 1/3] Ruff: Add and fix PTH113 --- dojo/settings/.settings.dist.py.sha256sum | 2 +- dojo/settings/settings.dist.py | 3 ++- ruff.toml | 2 +- unittests/test_parsers.py | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dojo/settings/.settings.dist.py.sha256sum b/dojo/settings/.settings.dist.py.sha256sum index 259f13a4c69..b4a5bb6802d 100644 --- a/dojo/settings/.settings.dist.py.sha256sum +++ b/dojo/settings/.settings.dist.py.sha256sum @@ -1 +1 @@ -6b9365d002880ae64ab54da905ede076db5a8661960f8f1e2793b7f4d25ff7e8 +d15d00db786392dc1099a06bd77aebc3e6aa0d9cfcd58e51b143a06521faaccd diff --git a/dojo/settings/settings.dist.py b/dojo/settings/settings.dist.py index 9920533272f..47714d14e3c 100644 --- a/dojo/settings/settings.dist.py +++ b/dojo/settings/settings.dist.py @@ -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 @@ -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(root("dojo/settings/.env.prod")).is_file() or "DD_ENV_PATH" in os.environ: env.read_env(root("dojo/settings/" + env.str("DD_ENV_PATH", ".env.prod"))) # ------------------------------------------------------------------------------ diff --git a/ruff.toml b/ruff.toml index 3a360f49891..c05a2649a0f 100644 --- a/ruff.toml +++ b/ruff.toml @@ -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", diff --git a/unittests/test_parsers.py b/unittests/test_parsers.py index 9e2ac077f14..54214140094 100644 --- a/unittests/test_parsers.py +++ b/unittests/test_parsers.py @@ -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(doc_file).is_file(), f"Documentation file '{doc_file}' is missing or using different name", ) @@ -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(parser_test_file).is_file(), f"Unittest of parser '{parser_test_file}' is missing or using different name", ) @@ -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(importer_test_file).is_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)): @@ -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(parser).is_file(), f"Parser '{parser}' is missing or using different name", ) From 350acc87a458d302cd0db1efa902883d4997c2e6 Mon Sep 17 00:00:00 2001 From: Manuel Sommer Date: Tue, 12 Nov 2024 19:30:12 +0100 Subject: [PATCH 2/3] sha sum --- dojo/settings/.settings.dist.py.sha256sum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dojo/settings/.settings.dist.py.sha256sum b/dojo/settings/.settings.dist.py.sha256sum index b4a5bb6802d..e6479e849d8 100644 --- a/dojo/settings/.settings.dist.py.sha256sum +++ b/dojo/settings/.settings.dist.py.sha256sum @@ -1 +1 @@ -d15d00db786392dc1099a06bd77aebc3e6aa0d9cfcd58e51b143a06521faaccd +e886c494f8946439bb974952b028cbd7ef385eb88b28d8100c7b2b4275bb00d7 From 00abea808f4ccea8b59facc53590c5190c81c949 Mon Sep 17 00:00:00 2001 From: Manuel Sommer Date: Tue, 12 Nov 2024 23:55:28 +0100 Subject: [PATCH 3/3] sha sum --- dojo/settings/.settings.dist.py.sha256sum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dojo/settings/.settings.dist.py.sha256sum b/dojo/settings/.settings.dist.py.sha256sum index e6479e849d8..8a1dcf4b5e3 100644 --- a/dojo/settings/.settings.dist.py.sha256sum +++ b/dojo/settings/.settings.dist.py.sha256sum @@ -1 +1 @@ -e886c494f8946439bb974952b028cbd7ef385eb88b28d8100c7b2b4275bb00d7 +25cf15456493c8592141326ab8a955207db2d2b33619b8f5d7b7e8767b8ba3aa