diff --git a/pyproject.toml b/pyproject.toml index 401a0ae9..ae19a5c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,7 +102,7 @@ sec-certs = "sec_certs.cli:main" [tool.ruff] - select = [ + lint.select = [ "I", # isort "E", # pycodestyle "W", # pycodestyle @@ -113,14 +113,14 @@ "C4", # comprehensions "SIM", ] - ignore = [ + lint.ignore = [ "E501", # line-length, should be handled by ruff format ] src = ["src", "tests"] line-length = 120 target-version = "py310" - [tool.ruff.mccabe] + [tool.ruff.lint.mccabe] max-complexity = 10 [tool.setuptools.package-data] diff --git a/src/sec_certs/sample/cpe.py b/src/sec_certs/sample/cpe.py index 5e9e8b65..e8ec29eb 100644 --- a/src/sec_certs/sample/cpe.py +++ b/src/sec_certs/sample/cpe.py @@ -32,16 +32,16 @@ def __lt__(self, other: CPEMatchCriteria) -> bool: @classmethod def from_nist_dict(cls, dct: dict[str, Any]) -> CPEMatchCriteria: - if dct.get("versionStartIncluding", None): + if dct.get("versionStartIncluding"): version_start = ("including", dct["versionStartIncluding"]) elif dct.get("versionStartExcluding"): version_start = ("excluding", dct["versionStartExcluding"]) else: version_start = None - if dct.get("versionEndIncluding", None): + if dct.get("versionEndIncluding"): version_end = ("including", dct["versionEndIncluding"]) - elif dct.get("versionEndExcluding", None): + elif dct.get("versionEndExcluding"): version_end = ("excluding", dct["versionEndExcluding"]) else: version_end = None diff --git a/src/sec_certs/sample/fips.py b/src/sec_certs/sample/fips.py index 8e9268cf..26b9833e 100644 --- a/src/sec_certs/sample/fips.py +++ b/src/sec_certs/sample/fips.py @@ -53,7 +53,7 @@ def get_web_data_and_algorithms(self) -> tuple[set[str], FIPSCertificate.WebData def _build_details_dict(self, details_div: Tag) -> dict[str, Any]: def parse_single_detail_entry(key, entry): normalized_key = DETAILS_KEY_NORMALIZATION_DICT[key] - normalization_func = DETAILS_KEY_TO_NORMALIZATION_FUNCTION.get(normalized_key, None) + normalization_func = DETAILS_KEY_TO_NORMALIZATION_FUNCTION.get(normalized_key) normalized_entry = ( FIPSHTMLParser.normalize_string(entry.text) if not normalization_func else normalization_func(entry) ) diff --git a/src/sec_certs/utils/extract.py b/src/sec_certs/utils/extract.py index 669cbcfc..340ad568 100644 --- a/src/sec_certs/utils/extract.py +++ b/src/sec_certs/utils/extract.py @@ -727,8 +727,7 @@ def load_text_file( whole_text = "" whole_text_with_newlines = "" - lines_included = 0 - for line in lines: + for lines_included, line in enumerate(lines): if limit_max_lines != -1 and lines_included >= limit_max_lines: break @@ -736,7 +735,6 @@ def load_text_file( line = line.replace("\n", "") whole_text += line whole_text += line_separator - lines_included += 1 return whole_text, whole_text_with_newlines, was_unicode_decode_error