Skip to content

Commit eff2f9b

Browse files
committed
Update advisories_count function
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 8da445f commit eff2f9b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

vulnerabilities/pipelines/v2_importers/alpine_linux_importer.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ def steps(cls):
4646
)
4747

4848
def advisories_count(self) -> int:
49-
base_path = Path(self.vcs_response.dest_dir) / "secdb"
50-
count = 0
51-
52-
for json_file in base_path.rglob("*.json"):
53-
data = json.loads(json_file.read_text(encoding="utf-8"))
54-
for pkg in data.get("packages", []):
55-
count += len(pkg.get("advisories", []))
56-
57-
return count
49+
return sum(
50+
len(pkg.get("advisories", []))
51+
for data in (
52+
json.loads(p.read_text())
53+
for p in (Path(self.vcs_response.dest_dir) / "secdb").rglob("*.json")
54+
)
55+
for pkg in data.get("packages", [])
56+
)
5857

5958
def clone(self):
6059
self.log(f"Cloning `{self.repo_url}`")

0 commit comments

Comments
 (0)