Skip to content

Commit 1433674

Browse files
add prysk test for pprint
1 parent 3292796 commit 1433674

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

exasol/toolbox/tools/security.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
)
1818
from noxconfig import PROJECT_CONFIG
1919
import typer
20+
from pathlib import Path
2021

2122
stdout = print
2223
stderr = partial(print, file=sys.stderr)
@@ -100,7 +101,7 @@ def from_maven(report: str) -> Iterable[Issue]:
100101
)
101102

102103

103-
def from_json(report_str: str) -> Iterable[Issue]:
104+
def from_json(report_str: str, prefix: Path = PROJECT_CONFIG.root) -> Iterable[Issue]:
104105
report = json.loads(report_str)
105106
issues = report.get("results", {})
106107
for issue in issues:
@@ -116,7 +117,7 @@ def from_json(report_str: str) -> Iterable[Issue]:
116117
cwe=str(issue.get("issue_cwe", {}).get("id", "")),
117118
description=issue["issue_text"],
118119
coordinates=issue["filename"].replace(
119-
str(PROJECT_CONFIG.root) + "/", ""
120+
str(prefix) + "/", ""
120121
) + ":" + str(issue["line_number"]) + ":" + str(issue["col_offset"]) + ":",
121122
references=tuple(references)
122123
)

test/integration/cli/security-pprint.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Create test input
77
> "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",
88
> "col_offset": 16,
99
> "end_col_offset": 17,
10-
> "filename": "/home/user/Git/python-toolbox/exasol/toolbox/sphinx/multiversion/main.py",
10+
> "filename": "exasol/toolbox/sphinx/multiversion/main.py",
1111
> "issue_confidence": "HIGH",
1212
> "issue_cwe": {
1313
> "id": 78,

0 commit comments

Comments
 (0)