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 D403 #11063

Merged
merged 1 commit into from
Nov 1, 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/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2221,7 +2221,7 @@ def mass_model_updater(model_type, models, function, fields, page_size=1000, ord


def to_str_typed(obj):
"""for code that handles multiple types of objects, print not only __str__ but prefix the type of the object"""
"""For code that handles multiple types of objects, print not only __str__ but prefix the type of the object"""
return f"{type(obj)}: {obj}"


Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ select = [
"W",
"C90",
"I",
"D2", "D3",
"D2", "D3", "D403",
"UP",
"YTT",
"ASYNC",
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_apiv2_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_notification_template_multiple(self):
self.assertEqual("Notification template already exists", r.json()["non_field_errors"][0])

def test_user_notifications(self):
"""creates user and checks if template is assigned"""
"""Creates user and checks if template is assigned"""
user = {"user": self.create_test_user()}
r = self.client.get(reverse("notifications-list"), user, format="json")
self.assertEqual(r.status_code, 200)
Expand Down
8 changes: 4 additions & 4 deletions unittests/tools/test_github_vulnerability_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

class TestGithubVulnerabilityParser(DojoTestCase):
def test_parse_file_with_no_vuln_has_no_findings(self):
"""sample with zero vulnerability"""
"""Sample with zero vulnerability"""
with open("unittests/scans/github_vulnerability/github-0-vuln.json", encoding="utf-8") as testfile:
parser = GithubVulnerabilityParser()
findings = parser.get_findings(testfile, Test())
self.assertEqual(0, len(findings))

def test_parse_file_with_one_vuln_has_one_findings(self):
"""sample with one vulnerability"""
"""Sample with one vulnerability"""
with open("unittests/scans/github_vulnerability/github-1-vuln.json", encoding="utf-8") as testfile:
parser = GithubVulnerabilityParser()
findings = parser.get_findings(testfile, Test())
Expand All @@ -36,7 +36,7 @@ def test_parse_file_with_one_vuln_has_one_findings(self):
self.assertEqual(finding.unique_id_from_tool, "aabbccddeeff1122334401")

def test_parse_file_with_one_vuln_has_one_finding_and_dependabot_direct_link(self):
"""sample with one vulnerability"""
"""Sample with one vulnerability"""
with open("unittests/scans/github_vulnerability/github-1-vuln-repo-dependabot-link.json", encoding="utf-8") as testfile:
parser = GithubVulnerabilityParser()
findings = parser.get_findings(testfile, Test())
Expand All @@ -56,7 +56,7 @@ def test_parse_file_with_one_vuln_has_one_finding_and_dependabot_direct_link(sel
self.assertEqual(finding.unique_id_from_tool, "aabbccddeeff1122334401")

def test_parse_file_with_multiple_vuln_has_multiple_findings(self):
"""sample with five vulnerability"""
"""Sample with five vulnerability"""
with open("unittests/scans/github_vulnerability/github-5-vuln.json", encoding="utf-8") as testfile:
parser = GithubVulnerabilityParser()
findings = parser.get_findings(testfile, Test())
Expand Down
2 changes: 1 addition & 1 deletion unittests/tools/test_sarif_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_example_report(self):
self.common_checks(finding)

def test_suppression_report(self):
"""test report file having different suppression definitions"""
"""Test report file having different suppression definitions"""
with open(path.join(path.dirname(__file__), "../scans/sarif/suppression_test.sarif"), encoding="utf-8") as testfile:
parser = SarifParser()
findings = parser.get_findings(testfile, Test())
Expand Down
2 changes: 1 addition & 1 deletion unittests/tools/test_sonarqube_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def test_detailed_parse_file_with_table_in_table(self):
my_file_handle.close()

def test_detailed_parse_file_with_rule_undefined(self):
"""the vulnerability's rule is not in the list of rules"""
"""The vulnerability's rule is not in the list of rules"""
my_file_handle, _product, _engagement, test = self.init(
get_unit_tests_path() + "/scans/sonarqube/sonar-rule-undefined.html",
)
Expand Down
2 changes: 1 addition & 1 deletion unittests/tools/test_tenable_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_parse_some_findings_samples_nessus_legacy(self):
self.assertEqual("CVE-2005-1794", vulnerability_id)

def test_parse_some_findings_with_cvssv3_nessus_legacy(self):
"""test with cvssv3"""
"""Test with cvssv3"""
with open(path.join(path.dirname(__file__), "../scans/tenable/nessus/nessus_with_cvssv3.nessus"), encoding="utf-8") as testfile:
parser = TenableParser()
findings = parser.get_findings(testfile, self.create_test())
Expand Down
Loading