Skip to content

Commit 63b671a

Browse files
committed
fix: return skip result instead of fail when source not downloaded
Signed-off-by: behnazh-w <[email protected]>
1 parent 8a8cc69 commit 63b671a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/macaron/malware_analyzer/pypi_heuristics/metadata/type_stub_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def analyze(self, pypi_package_json: PyPIPackageJsonAsset) -> tuple[HeuristicRes
4444
# To improve accuracy, we should also check for stub files in the wheel distribution.
4545
result = pypi_package_json.download_sourcecode()
4646
if not result:
47-
return HeuristicResult.FAIL, {"message": "No source code files have been downloaded.", "pyi_files": 0}
47+
return HeuristicResult.SKIP, {"message": "No source code files have been downloaded.", "pyi_files": 0}
4848

4949
file_count = sum(
5050
sum(1 for f in files if f.endswith(".pyi"))

tests/malware_analyzer/pypi/test_type_stub_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_analyze_download_failed_raises_error(analyzer: TypeStubFileAnalyzer, py
6666
"""Test the analyzer raises SourceCodeError when source code download fails."""
6767
pypi_package_json.download_sourcecode.return_value = False
6868
assert (
69-
HeuristicResult.FAIL,
69+
HeuristicResult.SKIP,
7070
{"message": "No source code files have been downloaded.", "pyi_files": 0},
7171
) == analyzer.analyze(pypi_package_json)
7272

0 commit comments

Comments
 (0)