Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruff: Add and "fix" S104 #11067

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dojo/tools/contrast/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)
Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_copy_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions unittests/tools/test_contrast_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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):
Expand Down
Loading