Skip to content

Commit

Permalink
chore: update cloudsplaining to 0.7.0 (#6721)
Browse files Browse the repository at this point in the history
* update cloudsplaining to 0.7.0

* fix tests and typing

* fix Python 3.12 tests
  • Loading branch information
gruebel authored Sep 18, 2024
1 parent d9fd318 commit 99360ac
Show file tree
Hide file tree
Showing 7 changed files with 1,508 additions and 1,329 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gitpython = ">=3.1.30,<4.0.0"
jmespath = ">=1.0.0,<2.0.0"
tqdm = ">=4.65.0,<5.0.0"
packaging = ">=23.0,<24.0"
cloudsplaining = ">=0.6.2,<0.7.0"
cloudsplaining = ">=0.7.0,<0.8.0"
networkx = "<2.7"
dockerfile-parse =">=2.0.0,<3.0.0"
docker = ">=6.0.1,<8.0.0"
Expand Down
2,810 changes: 1,494 additions & 1,316 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion checkov/common/runners/runner_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def filter_runners_for_files(self, files: List[str]) -> None:

def remove_runner(self, runner: _BaseRunner) -> None:
if runner in self.runners:
self.runners.remove(runner)
self.runners.remove(runner) # type:ignore[arg-type] # existence is checked one line above

@staticmethod
def enrich_report_with_guidelines(scan_report: Report) -> None:
Expand Down
3 changes: 2 additions & 1 deletion checkov/common/util/tqdm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def turn_off_progress_bar(self) -> None:

@staticmethod
def should_show_progress_bar() -> bool:
if all([not LOGS_ENABLED, not RUN_IN_DOCKER, sys.__stdout__.isatty()]):
# making sure sys.__stdout__ is not None, but still need the type:ignore
if all([not LOGS_ENABLED, not RUN_IN_DOCKER, sys.__stdout__, sys.__stdout__.isatty()]): # type:ignore[union-attr]
return True
return False
11 changes: 8 additions & 3 deletions checkov/policies_3d/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from checkov.common.output.common import compare_table_items_severity
from checkov.policies_3d.record import Policy3dRecord

TABLE_WIDTH = 136
TABLE_WIDTH = 138


def merge_line_with_previous_table(line: str, table: PrettyTable) -> str:
Expand Down Expand Up @@ -225,10 +225,15 @@ def render_iac_violations_table(record: Policy3dRecord) -> str | None:

def create_iac_violations_table(file_path: str, resource_violation_details_map: Dict[str, Dict[str, Any]]) -> str:
columns = 5 # it really has only 4 columns, but the title would get a width of two columns
column_width = int(TABLE_WIDTH / columns)
table_width = TABLE_WIDTH
column_width = int(table_width / columns)

# on python 3.12 and above, the columns are a bit bigger, need to make them smaller to have consistency.
if sys.version_info >= (3, 12):
table_width = 136

iac_table_lines = create_iac_violations_overview_table_part(
table_width=TABLE_WIDTH, column_width=column_width, resource_violation_details_map=resource_violation_details_map
table_width=table_width, column_width=column_width, resource_violation_details_map=resource_violation_details_map
)

return (
Expand Down
7 changes: 1 addition & 6 deletions checkov/sca_package_2/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import itertools
import logging
import sys
from collections import defaultdict
from dataclasses import dataclass
from typing import List, Union, Dict, Any
Expand Down Expand Up @@ -278,14 +277,10 @@ def create_cli_license_violations_table(file_path: str,
def create_cli_cves_table(file_path: str, cve_count: CveCount, package_details_map: Dict[str, Dict[str, Any]],
lines_details_found: bool) -> str:
columns = 7
table_width = 159
table_width = 165
fixed_line_with = 159
column_width = int(table_width / columns)

# on python 3.12 and above, the columns are smaller, need to make them wider in order to have consistency.
if sys.version_info >= (3, 12):
table_width = 165

cve_table_lines = create_cve_summary_table_part(
table_width=table_width, column_width=column_width, cve_count=cve_count
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def run(self) -> None:
"jmespath>=1.0.0,<2.0.0",
"tqdm<5.0.0,>=4.65.0",
"packaging>=23.0,<24.0",
"cloudsplaining<0.7.0,>=0.6.2",
"cloudsplaining<0.8.0,>=0.7.0",
"networkx<2.7",
"dockerfile-parse<3.0.0,>=2.0.0",
"docker>=6.0.1,<8.0.0",
Expand Down

0 comments on commit 99360ac

Please sign in to comment.