From 0a22b5e7de6f4feadd7c2fbb9247157fbad2a607 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:54:26 +0200 Subject: [PATCH] Ruff: Add and "fix" S104 --- dojo/tools/contrast/parser.py | 2 +- ruff.toml | 2 +- unittests/test_copy_model.py | 2 +- unittests/tools/test_contrast_parser.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dojo/tools/contrast/parser.py b/dojo/tools/contrast/parser.py index 9367bdcf6dd..3fe340144a8 100644 --- a/dojo/tools/contrast/parser.py +++ b/dojo/tools/contrast/parser.py @@ -60,7 +60,7 @@ def get_findings(self, filename, test): finding.unsaved_endpoints = [] if row.get("Request URI"): endpoint = Endpoint( - host="0.0.0.0", + host="0.0.0.0", # noqa: S104 path=row.get("Request URI"), protocol=row.get("Request Protocol"), ) diff --git a/ruff.toml b/ruff.toml index cb7e9231257..649b03a036c 100644 --- a/ruff.toml +++ b/ruff.toml @@ -41,7 +41,7 @@ select = [ "UP", "YTT", "ASYNC", - "S2", "S5", "S7", "S101", "S112", "S311", + "S2", "S5", "S7", "S101", "S104", "S112", "S311", "FBT001", "FBT003", "A003", "A004", "A006", "COM", diff --git a/unittests/test_copy_model.py b/unittests/test_copy_model.py index 94c0b3ac4e5..2f20c6b6db3 100644 --- a/unittests/test_copy_model.py +++ b/unittests/test_copy_model.py @@ -109,7 +109,7 @@ def test_duplicate_finding_with_endpoints(self): product = self.create_product("test_deuplicate_finding", prod_type=product_type) engagement = self.create_engagement("eng", product) test = self.create_test(engagement=engagement, scan_type="NPM Audit Scan", title="test") - endpoint = Endpoint.from_uri("0.0.0.0") + endpoint = Endpoint.from_uri("0.0.0.0") # noqa: S104 endpoint.save() finding = Finding.objects.create(test=test, reporter=user) endpoint_status = Endpoint_Status.objects.create(finding=finding, endpoint=endpoint) diff --git a/unittests/tools/test_contrast_parser.py b/unittests/tools/test_contrast_parser.py index b2f7a48863c..479da4d4735 100644 --- a/unittests/tools/test_contrast_parser.py +++ b/unittests/tools/test_contrast_parser.py @@ -30,7 +30,7 @@ def test_example_report(self): self.assertEqual(1, len(finding.unsaved_endpoints)) endpoint = finding.unsaved_endpoints[0] self.assertEqual("http", endpoint.protocol) - self.assertEqual("0.0.0.0", endpoint.host) + self.assertEqual("0.0.0.0", endpoint.host) # noqa: S104 self.assertEqual("WebGoat/login.mvc", endpoint.path) with self.subTest(i=11): finding = findings[11] @@ -45,11 +45,11 @@ def test_example_report(self): self.assertEqual(4, len(finding.unsaved_endpoints)) endpoint = finding.unsaved_endpoints[0] self.assertEqual("http", endpoint.protocol) - self.assertEqual("0.0.0.0", endpoint.host) + self.assertEqual("0.0.0.0", endpoint.host) # noqa: S104 self.assertEqual("WebGoat/services/SoapRequest", endpoint.path) endpoint = finding.unsaved_endpoints[1] self.assertEqual("http", endpoint.protocol) - self.assertEqual("0.0.0.0", endpoint.host) + self.assertEqual("0.0.0.0", endpoint.host) # noqa: S104 self.assertEqual("WebGoat/attack", endpoint.path) def test_example2_report(self):