Skip to content

Commit 704b9a9

Browse files
committed
Format code
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent e0bd42d commit 704b9a9

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

vulnerabilities/importers/istio.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,28 @@
3131
class IstioImporter(Importer):
3232
spdx_license_expression = "Apache-2.0"
3333
license_url = "https://github.com/istio/istio.io/blob/master/LICENSE"
34+
repo_url = "git+https://github.com/istio/istio.io/"
3435

3536
def advisory_data(self) -> Set[AdvisoryData]:
36-
self.clone(repo_url="git+https://github.com/istio/istio.io/")
37+
self.clone(self.repo_url)
3738
path = Path(self.vcs_response.dest_dir)
3839
vuln = path / "content/en/news/security/"
39-
for f in vuln.glob("**/*.md"):
40+
for file in vuln.glob("**/*.md"):
4041
# Istio website has files with name starting with underscore, these contain metadata
4142
# required for rendering the website. We're not interested in these.
4243
# See also https://github.com/nexB/vulnerablecode/issues/563
43-
f = str(f)
44-
if f.endswith("_index.md"):
44+
file = str(file)
45+
if file.endswith("_index.md"):
4546
continue
46-
yield from self.process_file(f)
47+
yield from self.process_file(file)
4748

4849
def process_file(self, path):
4950

5051
data = self.get_data_from_md(path)
51-
release_date = parser.parse(data["publishdate"]).replace(tzinfo=pytz.UTC)
52+
published_date = data.get("publishdate")
53+
release_date = None
54+
if published_date:
55+
release_date = parser.parse(published_date).replace(tzinfo=pytz.UTC)
5256

5357
constraints = []
5458

@@ -87,10 +91,7 @@ def process_file(self, path):
8791
for cve_id in data.get("cves") or []:
8892

8993
if not cve_id.startswith("CVE"):
90-
cve_id = ""
91-
92-
if not data.get("release_ranges"):
93-
data["release_ranges"] = []
94+
continue
9495

9596
affected_packages = []
9697

0 commit comments

Comments
 (0)