Skip to content

Commit

Permalink
sean's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ojokure committed Jan 9, 2025
1 parent 4c49ad7 commit 335e8d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/verinfast/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ def parseRepo(self, path: str, repo_name: str, branch: str = None):
]

findings_success = False
if not self.config.dry:
self.log(msg=repo_name, tag="Scanning repository", display=True)
try:
with contextlib.redirect_stdout(io.StringIO()):
semgrep_scan.scan(custom_args)
Expand Down
9 changes: 7 additions & 2 deletions tests/test_dry.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ def test_no_config(self):
assert get_url == "/report/uuid/9a6e8696-f93a-4402-a64e-342ccb37592b/CorsisCode", get_url # noqa: E501
agent.scan()
assert Path(results_dir).exists()
files = os.listdir(results_dir)
assert len(files) == 1
# Make sure there are no .json results files
results_path = Path(results_dir)
assert results_path.exists()

# Check if there are any JSON files
json_files = list(results_path.glob("*.json"))
assert not json_files, f"Found JSON files: {json_files}"
with open(agent.debug.file) as f:
logText = f.read()
assert "Error" not in logText
Expand Down

0 comments on commit 335e8d4

Please sign in to comment.