aboutcode-org / aboutcode-org/vulnerablecode

Improve readability for apache_httpd importer

Đang mở
#1,109 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
702
Fork
328
Merge trung bình
3 ngày 8 giờ
Pull request đã merge (30 ngày)
3

Mô tả

See line 87 above in the importer class, there is a lot of dict/key usage, often several levels like:
`for vendor in data["affects"]["vendor"]["vendor_data"]` and then again `for products in vendor["product"]["product_data"]`.

Shouldn't we probably use something like the `AdvisoryData` classes (or a special subclass for that) which would model the advisory data directly, and then use those classes everywhere instead of dicts. This has some advantages:

1. code would be more pythonic and readable (and better looking)
2. we can and should test for the advisory format and handle keyerrors gracefully (idk if the data format changes that much at all, but it could in future?)

_Originally posted by @AyanSinhaMahapatra in https://github.com/nexB/vulnerablecode/pull/1102#discussion_r1088817834_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.