diff --git a/.flake8 b/.flake8 index 442bbf7..1ed4a03 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -ignore = E203, E266, E501, W503, W605 +ignore = E203, E266, E501, W503, W605, C901 max-line-length = 79 max-complexity = 18 select = B,C,E,F,W,T4,B9 diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index a0c00e9..6932cee 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -28,7 +28,7 @@ jobs: pip install ".[dev]" - name: Lint with flake8 run: | - flake8 . --count --select=E9,F63,F7,F82 --show-source --exit-zero --statistics + flake8 . --count --show-source --exit-zero --statistics - name: Test with pytest run: | pytest --cov=vdb test diff --git a/test/test_source.py b/test/test_source.py index 4029611..0d0cfd2 100644 --- a/test/test_source.py +++ b/test/test_source.py @@ -386,6 +386,7 @@ def test_convert2(test_cve_wconfig_json): data = cvesource.convert(data) assert len(data) == 1 + def test_nvd_api_convert(test_nvd_api_json1, test_nvd_api_json2, test_nvd_api_json3): nvdlatest = NvdSource() data = nvdlatest.convert(test_nvd_api_json1) @@ -408,6 +409,7 @@ def test_nvd_api_convert(test_nvd_api_json1, test_nvd_api_json2, test_nvd_api_js data = cvesource.convert(data) assert len(data) == 0 + @pytest.mark.skip(reason="This downloads and tests with live data") def test_nvd_download(): nvdlatest = NvdSource() diff --git a/vdb/lib/__init__.py b/vdb/lib/__init__.py index 477eda8..8287ff5 100644 --- a/vdb/lib/__init__.py +++ b/vdb/lib/__init__.py @@ -1,4 +1,3 @@ -import orjson import os import re import tempfile @@ -6,6 +5,8 @@ from datetime import datetime from enum import Enum +import orjson + # Known application package types KNOWN_PKG_TYPES = [ "composer", diff --git a/vdb/lib/aqua.py b/vdb/lib/aqua.py index 40e829a..e949a1e 100644 --- a/vdb/lib/aqua.py +++ b/vdb/lib/aqua.py @@ -8,6 +8,7 @@ from zipfile import ZipFile import httpx +import orjson from vdb.lib import CustomNamedTemporaryFile, config from vdb.lib.nvd import NvdSource @@ -21,7 +22,6 @@ # Size of the stream to read and write to the file DOWNLOAD_CHUNK_SIZE = 4096 -import orjson threat_to_severity = { "unspecified": "LOW", diff --git a/vdb/lib/osv.py b/vdb/lib/osv.py index ce08e37..d9e2cce 100644 --- a/vdb/lib/osv.py +++ b/vdb/lib/osv.py @@ -6,6 +6,7 @@ from zipfile import ZipFile import httpx +import orjson from semver import Version from vdb.lib import CustomNamedTemporaryFile, config @@ -21,7 +22,6 @@ # Size of the stream to read and write to the file DOWNLOAD_CHUNK_SIZE = 4096 -import orjson vendor_overrides = { "apk": "alpine",