From 88f4ac53aa7f71640ea06f5c5d171dbb819e528a Mon Sep 17 00:00:00 2001 From: Christoph Kraemer Date: Wed, 23 Jun 2021 13:33:00 +0200 Subject: [PATCH] satisfy pylint --- ospd_openvas/daemon.py | 2 +- tests/helper.py | 4 +++- tests/test_preferencehandler.py | 4 ++-- tests/test_vthelper.py | 22 +++++++++++++++------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ospd_openvas/daemon.py b/ospd_openvas/daemon.py index d9e25bd8..b0c18815 100644 --- a/ospd_openvas/daemon.py +++ b/ospd_openvas/daemon.py @@ -56,7 +56,7 @@ if SENTRY_DSN_OSPD_OPENVAS: import sentry_sdk - sentry_sdk.init( + sentry_sdk.init( # pylint: disable=abstract-class-instantiated SENTRY_DSN_OSPD_OPENVAS, traces_sample_rate=1.0, server_name=environ.get('SENTRY_SERVER_NAME'), diff --git a/tests/helper.py b/tests/helper.py index c5dbcbe5..c6ff23df 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -36,5 +36,7 @@ def assert_called_once(mock: Mock): def assert_called(mock: Mock): """assert that the mock was called at least once""" if mock.call_count == 0: - msg = "Expected '%s' to have been called." % (mock._mock_name or 'mock') + msg = "Expected '%s' to have been called." % ( + mock._mock_name or 'mock' # pylint: disable=protected-access + ) raise AssertionError(msg) diff --git a/tests/test_preferencehandler.py b/tests/test_preferencehandler.py index 71d75973..fd3811b6 100644 --- a/tests/test_preferencehandler.py +++ b/tests/test_preferencehandler.py @@ -1237,8 +1237,8 @@ def test_prepare_alive_test_not_supplied_as_enum(self, mock_kb): p_handler.prepare_alive_test_option_for_openvas() self.assertEqual( - p_handler._nvts_params, - alive_test_out, # pylint: disable = protected-access + p_handler._nvts_params, # pylint: disable = protected-access + alive_test_out, ) @patch('ospd_openvas.db.KbDB') diff --git a/tests/test_vthelper.py b/tests/test_vthelper.py index 1cccd676..2c0e3c88 100644 --- a/tests/test_vthelper.py +++ b/tests/test_vthelper.py @@ -95,7 +95,7 @@ def test_get_single_vt_severity_cvssv3(self): 'excluded_keys': 'Settings/disable_cgi_scanning', 'family': 'Product detection', 'filename': 'mantis_detect.nasl', - 'last_modification': ('1533906565'), + 'last_modification': '1533906565', 'name': 'Mantis Detection', 'qod_type': 'remote_banner', 'required_ports': 'Services/www, 80', @@ -104,7 +104,7 @@ def test_get_single_vt_severity_cvssv3(self): 'solution_method': 'DebianAPTUpgrade', 'impact': 'some impact', 'insight': 'some insight', - 'summary': ('some summary'), + 'summary': 'some summary', 'affected': 'some affection', 'timeout': '0', 'vt_params': { @@ -119,7 +119,10 @@ def test_get_single_vt_severity_cvssv3(self): 'id': '2', 'default': 'no', 'description': 'Description', - 'name': 'Do not randomize the order in which ports are scanned', # pylint: disable=line-too-long + 'name': ( # pylint: disable=line-too-long + 'Do not randomize the order in which ports are' + ' scanned' + ), 'type': 'checkbox', }, }, @@ -153,7 +156,7 @@ def test_get_single_vt_severity_cvssv2(self): 'excluded_keys': 'Settings/disable_cgi_scanning', 'family': 'Product detection', 'filename': 'mantis_detect.nasl', - 'last_modification': ('1533906565'), + 'last_modification': '1533906565', 'name': 'Mantis Detection', 'qod_type': 'remote_banner', 'required_ports': 'Services/www, 80', @@ -162,7 +165,7 @@ def test_get_single_vt_severity_cvssv2(self): 'solution_method': 'DebianAPTUpgrade', 'impact': 'some impact', 'insight': 'some insight', - 'summary': ('some summary'), + 'summary': 'some summary', 'affected': 'some affection', 'timeout': '0', 'vt_params': { @@ -177,7 +180,10 @@ def test_get_single_vt_severity_cvssv2(self): 'id': '2', 'default': 'no', 'description': 'Description', - 'name': 'Do not randomize the order in which ports are scanned', # pylint: disable=line-too-long + 'name': ( # pylint: disable=line-too-long + 'Do not randomize the order in which ports are' + ' scanned' + ), 'type': 'checkbox', }, }, @@ -220,7 +226,9 @@ def test_get_severity_score_v3(self): vtaux = { 'severities': { 'severity_type': 'cvss_base_v3', - 'severity_base_vector': 'CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:L/A:L', + 'severity_base_vector': ( + 'CVSS:3.0/AV:L/AC:H/PR:H/UI:R/S:U/C:N/I:L/A:L' + ), } }