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 D411 #11064

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
1 change: 1 addition & 0 deletions dojo/tools/intsights/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def get_description_for_scan_types(self, scan_type):
def _build_finding_description(self, alert: dict) -> str:
"""
Builds an IntSights Finding description from various pieces of information.

Args:
alert: The parsed alert dictionary
Returns: A markdown formatted description
Expand Down
2 changes: 2 additions & 0 deletions dojo/tools/qualys/csv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def parse_csv(csv_file) -> [Finding]:
def get_report_findings(csv_reader) -> [dict]:
"""
Filters out the unneeded information at the beginning of the Qualys CSV report.

Args:
csv_reader:

Expand All @@ -55,6 +56,7 @@ def _extract_cvss_vectors(cvss_base, cvss_temporal):

This is done because the raw values come with additional characters that cannot be parsed with the cvss library.
Example: 6.7 (AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H)

Args:
cvss_base:
cvss_temporal:
Expand Down
5 changes: 5 additions & 0 deletions dojo/tools/whitehat_sentinel/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def _convert_whitehat_severity_id_to_dojo_severity(
) -> str | None:
"""
Converts a WhiteHat Sentinel numerical severity to a DefectDojo severity.

Args:
whitehat_severity_id: The WhiteHat Severity ID (called risk_id in the API)
Returns: A DefectDojo severity if a mapping can be found; otherwise a null value is returned
Expand All @@ -79,6 +80,7 @@ def _convert_whitehat_severity_id_to_dojo_severity(
def _parse_cwe_from_tags(self, whitehat_sentinel_tags) -> str:
"""
Some Vulns include the CWE ID as a tag. This is used to pull it out of that list and return only the ID.

Args:
whitehat_sentinel_tags: The Tags list from the WhiteHat vuln
Returns: The first CWE ID in the list, if it exists
Expand All @@ -91,6 +93,7 @@ def _parse_cwe_from_tags(self, whitehat_sentinel_tags) -> str:
def _parse_description(self, whitehat_sentinel_description: dict):
"""
Manually converts the HTML description to a DefectDojo-friendly format.

Args:
whitehat_sentinel_description: The description section of the WhiteHat Sentinel vulnerability dict
Returns: A dict with description and reference link
Expand Down Expand Up @@ -144,6 +147,7 @@ def _parse_solution(self, whitehat_sentinel_vuln_solution):
def __get_href_url(self, text_to_search):
"""
Searches for the anchor targets within a string that includes an anchor tag.

Args:
text_to_search: The text string to search for an anchor tag
Returns:
Expand All @@ -157,6 +161,7 @@ def __get_href_url(self, text_to_search):
def __remove_paragraph_tags(self, html_string):
"""
Manually remove <p> tags from HTML strings to avoid importing yet-another-library.

Args:
html_string: The HMTL string to remove <p> </p> tags from
Returns: The original string stipped of paragraph tags
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", "D403",
"D2", "D3", "D403", "D411",
"UP",
"YTT",
"ASYNC",
Expand Down
Loading