Skip to content

Commit 1f0d8bd

Browse files
authored
chore: enable mypy for bitbucket_pipelines and sca_package (bridgecrewio#3634)
* enable mypy for bitbucket_pipelines and sca_package * add packageurl-python also to setup.py * remove wrong change * fix CycloneDX tests
1 parent 85143e3 commit 1f0d8bd

File tree

26 files changed

+301
-154
lines changed

26 files changed

+301
-154
lines changed

Pipfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ types-cachetools = "*"
2525
types-colorama = "*"
2626
types-jmespath = "*"
2727
types-jsonschema = "~=3.0"
28+
types-prettytable = ">=3.0.0"
2829
types-pyyaml = ">=5.4.1"
2930
types-requests = "*"
3031
types-tabulate = "*"
@@ -68,7 +69,8 @@ policyuniverse = "*"
6869
typing-extensions = ">=4.1.0"
6970
importlib-metadata = ">=0.12"
7071
cachetools = "*"
71-
cyclonedx-python-lib = ">=2.4.0,<3.0.0"
72+
cyclonedx-python-lib = ">=2.4.0,<4.0.0"
73+
packageurl-python = "*"
7274
click = ">=8.0.0"
7375
aiohttp = "*"
7476
aiodns = "*"

Pipfile.lock

+85-78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checkov/bitbucket_pipelines/base_bitbucket_pipelines_check.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
from __future__ import annotations
2+
3+
from abc import abstractmethod
4+
from collections.abc import Iterable
5+
from typing import TYPE_CHECKING, Any
6+
17
from checkov.common.checks.base_check import BaseCheck
28

39
from checkov.common.models.enums import CheckCategories
410
from checkov.bitbucket_pipelines.registry import registry
511

12+
if TYPE_CHECKING:
13+
from checkov.common.models.enums import CheckResult
14+
615

716
class BaseBitbucketPipelinesCheck(BaseCheck):
8-
def __init__(self, name, id, supported_entities, block_type, path=None):
9-
categories = [CheckCategories.SUPPLY_CHAIN]
17+
def __init__(
18+
self, name: str, id: str, supported_entities: Iterable[str], block_type: str, path: str | None = None
19+
) -> None:
20+
categories = (CheckCategories.SUPPLY_CHAIN,)
1021

1122
super().__init__(
1223
name=name,
@@ -17,3 +28,12 @@ def __init__(self, name, id, supported_entities, block_type, path=None):
1728
)
1829
self.path = path
1930
registry.register(self)
31+
32+
def scan_entity_conf(self, conf: dict[str, Any], entity_type: str) -> tuple[CheckResult, dict[str, Any]]: # type:ignore[override] # multi_signature decorator is problematic
33+
self.entity_type = entity_type
34+
35+
return self.scan_conf(conf)
36+
37+
@abstractmethod
38+
def scan_conf(self, conf: dict[str, Any]) -> tuple[CheckResult, dict[str, Any]]:
39+
pass

0 commit comments

Comments
 (0)