Skip to content

Commit

Permalink
chore: remove file noqa on SLES parser
Browse files Browse the repository at this point in the history
Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed Oct 26, 2023
1 parent 3e92103 commit 64842a6
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/vunnel/providers/sles/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from __future__ import annotations

import logging
Expand All @@ -7,6 +6,7 @@
from collections import defaultdict
from dataclasses import dataclass
from decimal import Decimal, DecimalException
from typing import TYPE_CHECKING

import requests
from cvss import CVSS3
Expand All @@ -26,7 +26,9 @@
iter_parse_vulnerability_file,
)
from vunnel.utils.vulnerability import CVSS, CVSSBaseMetrics, FixedIn, Vulnerability
from vunnel.workspace import Workspace

if TYPE_CHECKING:
from vunnel.workspace import Workspace

namespace = "sles"

Expand Down Expand Up @@ -54,7 +56,11 @@ class Parser:
logger = logging.getLogger("sles-parser")

def __init__(
self, workspace: Workspace, allow_versions: list[str], download_timeout: int = 125, logger: logging.Logger | None = None
self,
workspace: Workspace,
allow_versions: list[str],
download_timeout: int = 125,
logger: logging.Logger | None = None,
):
self.oval_dir_path = os.path.join(workspace.input_path, self.__source_dir_path__, self.__oval_dir_path__)
self.allow_versions = allow_versions
Expand Down Expand Up @@ -102,7 +108,11 @@ def _download(self, major_version: str) -> str:

@classmethod
def _get_name_and_version_from_test(
cls, test_id: str, tests_dict: dict, artifacts_dict: dict, versions_dict: dict
cls,
test_id: str,
tests_dict: dict,
artifacts_dict: dict,
versions_dict: dict,
) -> tuple[str | None, str | None]:
name = None
version = None
Expand Down Expand Up @@ -214,7 +224,7 @@ def _release_resolver(
return results

@classmethod
def _transform_oval_vulnerabilities(cls, major_version: str, parsed_dict: dict) -> list[Vulnerability]:
def _transform_oval_vulnerabilities(cls, major_version: str, parsed_dict: dict) -> list[Vulnerability]: # noqa: C901
cls.logger.info(
"generating normalized vulnerabilities from oval vulnerabilities for %s",
major_version,
Expand Down Expand Up @@ -297,7 +307,7 @@ def _transform_oval_vulnerabilities(cls, major_version: str, parsed_dict: dict)
Version=pkg_version,
Module=None,
VendorAdvisory=None,
)
),
)

# create the normalized vulnerability
Expand Down Expand Up @@ -406,7 +416,7 @@ def parse(cls, xml_element, config: OVALParserConfig) -> SLESOVALVulnerability |
_, vector = cvss_v3.split("/", 1)
cvss.append(vector)

impact = VulnerabilityParser._parse_criteria(xml_element, oval_ns, config)
impact = VulnerabilityParser._parse_criteria(xml_element, oval_ns, config) # noqa: SLF001
except Exception:
cls.logger.exception("ignoring error and skip parsing vulnerability definition element")
identity = name = severity = description = link = None
Expand Down

0 comments on commit 64842a6

Please sign in to comment.