diff --git a/dojo/api_v2/prefetch/prefetcher.py b/dojo/api_v2/prefetch/prefetcher.py index 917afd2a048..1c45e309dce 100644 --- a/dojo/api_v2/prefetch/prefetcher.py +++ b/dojo/api_v2/prefetch/prefetcher.py @@ -24,6 +24,7 @@ def _build_serializers(): Returns: dict[model, serializer]: map of model to their serializer + """ def _is_model_serializer(obj): @@ -61,6 +62,7 @@ def _find_serializer(self, field_type): Returns: rest_framework.serializers.ModelSerializer: The serializer if one has been found or None + """ # If the type is represented in the map then return the serializer if field_type in self._serializers: @@ -80,6 +82,7 @@ def _prefetch(self, entry, fields_to_fetch): Args: entry (ModelInstance): Instance of a model as returned by a django queryset field_to_fetch (list[string]): fields to prefetch + """ for field_to_fetch in fields_to_fetch: # Get the field from the instance diff --git a/dojo/api_v2/prefetch/utils.py b/dojo/api_v2/prefetch/utils.py index 5e588e03ce8..eefb1b642ec 100644 --- a/dojo/api_v2/prefetch/utils.py +++ b/dojo/api_v2/prefetch/utils.py @@ -12,6 +12,7 @@ def _is_many_to_many_relation(field): Returns: bool: true if the field is a many-to-many relationship + """ return isinstance(field, related.ManyToManyDescriptor) @@ -27,6 +28,7 @@ def _is_one_to_one_relation(field): Returns: bool: true if the field is a one-to-one relationship + """ return isinstance(field, related.ForwardManyToOneDescriptor) @@ -38,6 +40,7 @@ def _get_prefetchable_fields(serializer): Args: serializer (Serializer): [description] + """ def _is_field_prefetchable(field): diff --git a/dojo/tools/intsights/parser.py b/dojo/tools/intsights/parser.py index 3e6219a4662..85b0c78eb31 100644 --- a/dojo/tools/intsights/parser.py +++ b/dojo/tools/intsights/parser.py @@ -26,6 +26,7 @@ def _build_finding_description(self, alert: dict) -> str: Args: alert: The parsed alert dictionary Returns: A markdown formatted description + """ return "\n".join( [ diff --git a/dojo/tools/qualys/csv_parser.py b/dojo/tools/qualys/csv_parser.py index 46e49eaedbc..a0652091132 100644 --- a/dojo/tools/qualys/csv_parser.py +++ b/dojo/tools/qualys/csv_parser.py @@ -60,6 +60,7 @@ def _extract_cvss_vectors(cvss_base, cvss_temporal): cvss_temporal: Returns: A CVSS3 Vector including both Base and Temporal if available + """ vector_pattern = r"^\d{1,2}.\d \((.*)\)" cvss_vector = "CVSS:3.0/" diff --git a/dojo/tools/whitehat_sentinel/parser.py b/dojo/tools/whitehat_sentinel/parser.py index c23d002cb84..18e1c698011 100644 --- a/dojo/tools/whitehat_sentinel/parser.py +++ b/dojo/tools/whitehat_sentinel/parser.py @@ -60,6 +60,7 @@ def _convert_whitehat_severity_id_to_dojo_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 + """ severities = [ "Informational", @@ -82,6 +83,7 @@ def _parse_cwe_from_tags(self, whitehat_sentinel_tags) -> str: Args: whitehat_sentinel_tags: The Tags list from the WhiteHat vuln Returns: The first CWE ID in the list, if it exists + """ for tag in whitehat_sentinel_tags: if tag.startswith("CWE-"): @@ -94,6 +96,7 @@ def _parse_description(self, whitehat_sentinel_description: dict): Args: whitehat_sentinel_description: The description section of the WhiteHat Sentinel vulnerability dict Returns: A dict with description and reference link + """ description_ref = {"description": "", "reference_link": ""} @@ -147,6 +150,7 @@ def __get_href_url(self, text_to_search): Args: text_to_search: The text string to search for an anchor tag Returns: + """ links = "" @@ -160,6 +164,7 @@ def __remove_paragraph_tags(self, html_string): Args: html_string: The HMTL string to remove
tags from Returns: The original string stipped of paragraph tags + """ return re.sub(r"
|
", "", html_string) @@ -193,6 +198,7 @@ def _convert_whitehat_sentinel_vulns_to_dojo_finding( whitehat_sentinel_vulns: The vuln dictionary from WhiteHat Sentinel vuln API test: The test ID that the DefectDojo finding should be associated with Returns: A DefectDojo Finding object + """ dupes = {} diff --git a/dojo/utils.py b/dojo/utils.py index 0e340f2ce01..58d769a0ed5 100644 --- a/dojo/utils.py +++ b/dojo/utils.py @@ -88,6 +88,7 @@ def do_false_positive_history(finding, *args, **kwargs): Args: finding (:model:`dojo.Finding`): Finding to be replicated + """ to_mark_as_fp = set() @@ -149,6 +150,7 @@ def match_finding_to_existing_findings(finding, product=None, engagement=None, t product (:model:`dojo.Product`, optional): Product to filter findings by engagement (:model:`dojo.Engagement`, optional): Engagement to filter findings by test (:model:`dojo.Test`, optional): Test to filter findings by + """ if product: custom_filter_type = "product" diff --git a/ruff.toml b/ruff.toml index cb7e9231257..4027bf97963 100644 --- a/ruff.toml +++ b/ruff.toml @@ -37,7 +37,7 @@ select = [ "W", "C90", "I", - "D2", "D3", "D403", + "D2", "D3", "D403", "D413", "UP", "YTT", "ASYNC",