From 17c32f7f0283a7944f825ccea819ad959acc09fa Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Tue, 24 Oct 2023 13:34:26 +0200 Subject: [PATCH] Add additional debug output --- exasol/toolbox/tools/security.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/exasol/toolbox/tools/security.py b/exasol/toolbox/tools/security.py index 40a444015..a5f01015d 100644 --- a/exasol/toolbox/tools/security.py +++ b/exasol/toolbox/tools/security.py @@ -2,6 +2,7 @@ import re import subprocess import sys +from functools import partial from inspect import cleandoc from typing import ( Generator, @@ -10,8 +11,6 @@ ) import typer -from functools import partial -import sys stdout = print stderr = partial(print, file=sys.stderr) @@ -170,12 +169,12 @@ def create_security_issue(issue: Issue) -> Tuple[str, str]: @ISSUE_CLI.command(name="convert") def convert( - format: str = typer.Argument(..., help="input format to be converted."), + format: str = typer.Argument(..., help="input format to be converted."), ) -> None: if format == "maven": issues = from_maven(sys.stdin.read()) for issue in _issues_as_json_str(issues): - print(issue) + stdout(issue) else: stderr(f"Unsupported format: {format}") sys.exit(-1) @@ -183,7 +182,7 @@ def convert( @ISSUE_CLI.command(name="filter") def filter( - type: str = typer.Argument(..., help="filter type to apply"), + type: str = typer.Argument(..., help="filter type to apply"), ) -> None: if type != "github": stderr( @@ -193,6 +192,11 @@ def filter( stdout(line) to_be_filtered = list(gh_security_issues()) + stderr( + "Filtering:\n{issues}".format( + issues="\n".join(f"- {i}" for i in to_be_filtered) + ) + ) filtered_issues = [ issue for issue in _issues(sys.stdin) if issue.cve not in to_be_filtered ]