Skip to content

Commit

Permalink
add prysk test for pprint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis-Mittenzwei committed Oct 18, 2024
1 parent 3292796 commit 1433674
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions exasol/toolbox/tools/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
from noxconfig import PROJECT_CONFIG
import typer
from pathlib import Path

stdout = print
stderr = partial(print, file=sys.stderr)
Expand Down Expand Up @@ -100,7 +101,7 @@ def from_maven(report: str) -> Iterable[Issue]:
)


def from_json(report_str: str) -> Iterable[Issue]:
def from_json(report_str: str, prefix: Path = PROJECT_CONFIG.root) -> Iterable[Issue]:
report = json.loads(report_str)
issues = report.get("results", {})
for issue in issues:
Expand All @@ -116,7 +117,7 @@ def from_json(report_str: str) -> Iterable[Issue]:
cwe=str(issue.get("issue_cwe", {}).get("id", "")),
description=issue["issue_text"],
coordinates=issue["filename"].replace(
str(PROJECT_CONFIG.root) + "/", ""
str(prefix) + "/", ""
) + ":" + str(issue["line_number"]) + ":" + str(issue["col_offset"]) + ":",
references=tuple(references)
)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cli/security-pprint.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Create test input
> "code": "555 subprocess.check_call(\n556 config.smv_postbuild_command, cwd=current_cwd, shell=True\n557 )\n558 if config.smv_postbuild_export_pattern != \"\":\n559 matches = find_matching_files_and_dirs(\n",
> "col_offset": 16,
> "end_col_offset": 17,
> "filename": "/home/user/Git/python-toolbox/exasol/toolbox/sphinx/multiversion/main.py",
> "filename": "exasol/toolbox/sphinx/multiversion/main.py",
> "issue_confidence": "HIGH",
> "issue_cwe": {
> "id": 78,
Expand Down

0 comments on commit 1433674

Please sign in to comment.