diff --git a/tests/helper/test_date_format.py b/tests/helper/test_date_format.py index 81c8700a..a3b58b5b 100644 --- a/tests/helper/test_date_format.py +++ b/tests/helper/test_date_format.py @@ -7,7 +7,6 @@ class CheckCreationDateTestCase(TestCase): - def test_ok(self): results = list( check_date( diff --git a/tests/plugins/test_copyright_text.py b/tests/plugins/test_copyright_text.py index ef2a6468..12ca9824 100644 --- a/tests/plugins/test_copyright_text.py +++ b/tests/plugins/test_copyright_text.py @@ -130,6 +130,6 @@ def test_fix_wrong_copyright_text(self): self.assertIsInstance(results[0], LinterFix) self.assertEqual( - "The copyright statement has been updated to " f"{CORRECT_COPYRIGHT_PHRASE}", + f"The copyright statement has been updated to {CORRECT_COPYRIGHT_PHRASE}", results[0].message, ) diff --git a/tests/plugins/test_copyright_year.py b/tests/plugins/test_copyright_year.py index e4399fe8..7bd1c347 100644 --- a/tests/plugins/test_copyright_year.py +++ b/tests/plugins/test_copyright_year.py @@ -180,7 +180,7 @@ def test_pre2008_fail(self): results[0].message, ) self.assertEqual( - "a pre2008 vt has a copyright value in the fileheader" " newer than the creation_year", + "a pre2008 vt has a copyright value in the fileheader newer than the creation_year", results[1].message, ) diff --git a/tests/plugins/test_creation_date.py b/tests/plugins/test_creation_date.py index 69788626..231610e6 100644 --- a/tests/plugins/test_creation_date.py +++ b/tests/plugins/test_creation_date.py @@ -24,7 +24,6 @@ class CheckCreationDateTestCase(PluginTestCase): - def test_ok(self): path = Path("some/file.nasl") content = ( diff --git a/tests/plugins/test_cve_format.py b/tests/plugins/test_cve_format.py index c6d0d878..55b5a5fe 100644 --- a/tests/plugins/test_cve_format.py +++ b/tests/plugins/test_cve_format.py @@ -28,7 +28,7 @@ class CheckCVEFormatTestCase(PluginTestCase): def test_ok(self): path = Path("some/file.nasl") content = ( - ' script_tag(name:"cvss_base", value:"7.5");\n' ' script_cve_id("CVE-2022-23807");\n' + ' script_tag(name:"cvss_base", value:"7.5");\n script_cve_id("CVE-2022-23807");\n' ) fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckCVEFormat(fake_context) @@ -74,7 +74,7 @@ def test_no_cve_reference(self): def test_invalid_cve_format(self): path = Path("some/file.nasl") content = ( - ' script_tag(name:"cvss_base", value:"10.0");\n' ' script_cve_id("CVE-a123-23807");\n' + ' script_tag(name:"cvss_base", value:"10.0");\n script_cve_id("CVE-a123-23807");\n' ) fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckCVEFormat(fake_context) @@ -91,7 +91,7 @@ def test_invalid_cve_format(self): def test_more_then_four_digits(self): path = Path("some/file.nasl") content = ( - ' script_tag(name:"cvss_base", value:"7.5");\n' ' script_cve_id("CVE-2021-03807");\n' + ' script_tag(name:"cvss_base", value:"7.5");\n script_cve_id("CVE-2021-03807");\n' ) fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) @@ -109,7 +109,7 @@ def test_more_then_four_digits(self): def test_invalid_year(self): path = Path("some/file.nasl") content = ( - ' script_tag(name:"cvss_base", value:"7.5");\n' ' script_cve_id("CVE-1971-3807");\n' + ' script_tag(name:"cvss_base", value:"7.5");\n script_cve_id("CVE-1971-3807");\n' ) fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckCVEFormat(fake_context) diff --git a/tests/plugins/test_cvss_format.py b/tests/plugins/test_cvss_format.py index 7bf4febc..c0ef7897 100644 --- a/tests/plugins/test_cvss_format.py +++ b/tests/plugins/test_cvss_format.py @@ -68,7 +68,7 @@ def test_invalid_base(self): def test_missing_base(self): path = Path("some/file.nasl") - content = ' script_tag(name:"cvss_base_vector", ' 'value:"AV:N/AC:L/Au:S/C:N/I:P/A:N");\n' + content = ' script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:S/C:N/I:P/A:N");\n' fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckCVSSFormat(fake_context) diff --git a/tests/plugins/test_dependencies.py b/tests/plugins/test_dependencies.py index ec5bd9e3..e217208f 100644 --- a/tests/plugins/test_dependencies.py +++ b/tests/plugins/test_dependencies.py @@ -88,7 +88,7 @@ def test_dependency_missing(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - f"The script dependency {dependency} could " "not be found within the VTs.", + f"The script dependency {dependency} could not be found within the VTs.", results[0].message, ) @@ -187,7 +187,7 @@ def test_dependency_missing_newline(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "The script dependency example2.nasl could " "not be found within the VTs.", + "The script dependency example2.nasl could not be found within the VTs.", results[0].message, ) diff --git a/tests/plugins/test_dependency_category_order.py b/tests/plugins/test_dependency_category_order.py index 3f392eb2..3b32f793 100644 --- a/tests/plugins/test_dependency_category_order.py +++ b/tests/plugins/test_dependency_category_order.py @@ -86,7 +86,7 @@ def test_dependency_missing(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - f"The script dependency {dependency} could " "not be found within the VTs.", + f"The script dependency {dependency} could not be found within the VTs.", results[0].message, ) diff --git a/tests/plugins/test_deprecated_dependency.py b/tests/plugins/test_deprecated_dependency.py index a9612196..b09c145e 100644 --- a/tests/plugins/test_deprecated_dependency.py +++ b/tests/plugins/test_deprecated_dependency.py @@ -127,7 +127,7 @@ def test_dependency_missing(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - f"The script dependency {dependency} could " "not be found within the VTs.", + f"The script dependency {dependency} could not be found within the VTs.", results[0].message, ) diff --git a/tests/plugins/test_deprecated_functions.py b/tests/plugins/test_deprecated_functions.py index ba48bc46..03326629 100644 --- a/tests/plugins/test_deprecated_functions.py +++ b/tests/plugins/test_deprecated_functions.py @@ -55,10 +55,9 @@ def test_ok_comment(self): def test_deprecated_functions(self): deprecated_output = { - 'script_summary();, use script_tag(name:"' - 'summary", value:""); instead': " script_" + 'script_summary();, use script_tag(name:"summary", value:""); instead': " script_" 'summary("deprecated");', - "script_id();, use script_oid(); with " "the full OID instead": " script_id(123345);", + "script_id();, use script_oid(); with the full OID instead": " script_id(123345);", "security_note();": ' security_note("deprecated");', "security_warning();": ' security_warning("deprecated");', "security_hole();": ' security_hole("deprecated");', diff --git a/tests/plugins/test_double_end_points.py b/tests/plugins/test_double_end_points.py index 6e9a0a54..14b1061a 100644 --- a/tests/plugins/test_double_end_points.py +++ b/tests/plugins/test_double_end_points.py @@ -60,6 +60,6 @@ def test_invalid(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "The script tag 'summary' " "is ending with two or more points: " "'Foo Bar...'.", + "The script tag 'summary' is ending with two or more points: 'Foo Bar...'.", results[0].message, ) diff --git a/tests/plugins/test_duplicate_oid.py b/tests/plugins/test_duplicate_oid.py index b347c932..940ae847 100644 --- a/tests/plugins/test_duplicate_oid.py +++ b/tests/plugins/test_duplicate_oid.py @@ -52,7 +52,7 @@ def test_ok_no_script_oid(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "Could not find an OID" " in 'test_files/nasl/21.04/fail_badwords.nasl'.", + "Could not find an OID in 'test_files/nasl/21.04/fail_badwords.nasl'.", results[0].message, ) diff --git a/tests/plugins/test_duplicated_script_tags.py b/tests/plugins/test_duplicated_script_tags.py index 788fcf5c..2cbc55e9 100644 --- a/tests/plugins/test_duplicated_script_tags.py +++ b/tests/plugins/test_duplicated_script_tags.py @@ -62,7 +62,7 @@ def test_duplicated_function(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "The VT is using the script tag " "'script_name' multiple number of times.", + "The VT is using the script tag 'script_name' multiple number of times.", results[0].message, ) @@ -80,7 +80,7 @@ def test_duplicated_tag(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "The VT is using the script tag " "'cvss_base' multiple number of times.", + "The VT is using the script tag 'cvss_base' multiple number of times.", results[0].message, ) diff --git a/tests/plugins/test_script_add_preference_type.py b/tests/plugins/test_script_add_preference_type.py index 1f1fbe04..760b88de 100644 --- a/tests/plugins/test_script_add_preference_type.py +++ b/tests/plugins/test_script_add_preference_type.py @@ -97,9 +97,7 @@ def test_invalid_with_parameters_order(self): ) path = Path("some/file.nasl") content = ( - ' script_tag(name:"cvss_base", value:"4.0");\n' - ' script_name("Foo Bar");\n' - f"{add_pref}\n" + f' script_tag(name:"cvss_base", value:"4.0");\n script_name("Foo Bar");\n{add_pref}\n' ) fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckScriptAddPreferenceType(fake_context) @@ -119,9 +117,7 @@ def test_missing_type(self): add_pref = 'script_add_preference(name:"File or Directory Name", value:"/home", id:1);' path = Path("some/file.nasl") content = ( - ' script_tag(name:"cvss_base", value:"4.0");\n' - ' script_name("Foo Bar");\n' - f"{add_pref}\n" + f' script_tag(name:"cvss_base", value:"4.0");\n script_name("Foo Bar");\n{add_pref}\n' ) fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckScriptAddPreferenceType(fake_context) diff --git a/tests/plugins/test_script_copyright.py b/tests/plugins/test_script_copyright.py index d427fd99..28e52a1b 100644 --- a/tests/plugins/test_script_copyright.py +++ b/tests/plugins/test_script_copyright.py @@ -54,7 +54,7 @@ def test_copyright_error(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertIn( - "The VT is using an incorrect syntax for its " "copyright statement.", + "The VT is using an incorrect syntax for its copyright statement.", results[0].message, ) @@ -69,7 +69,7 @@ def test_copyright_error2(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertIn( - "The VT is using an incorrect syntax for its " "copyright statement.", + "The VT is using an incorrect syntax for its copyright statement.", results[0].message, ) @@ -84,6 +84,6 @@ def test_copyright_error3(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertIn( - "The VT is using an incorrect syntax for its " "copyright statement.", + "The VT is using an incorrect syntax for its copyright statement.", results[0].message, ) diff --git a/tests/plugins/test_script_version_and_last_modification_tags.py b/tests/plugins/test_script_version_and_last_modification_tags.py index 639ecefe..cde99dba 100644 --- a/tests/plugins/test_script_version_and_last_modification_tags.py +++ b/tests/plugins/test_script_version_and_last_modification_tags.py @@ -68,7 +68,7 @@ def test_nok(self): results[0].message, ) self.assertEqual( - "VT is is using a wrong syntax for script_tag(name:" '"last_modification".', + 'VT is is using a wrong syntax for script_tag(name:"last_modification".', results[1].message, ) @@ -91,7 +91,7 @@ def test_old_nok(self): results[0].message, ) self.assertEqual( - "VT is is using a wrong syntax for script_tag(name:" '"last_modification".', + 'VT is is using a wrong syntax for script_tag(name:"last_modification".', results[1].message, ) diff --git a/tests/plugins/test_script_xref_url.py b/tests/plugins/test_script_xref_url.py index 26553b6c..1365aa71 100644 --- a/tests/plugins/test_script_xref_url.py +++ b/tests/plugins/test_script_xref_url.py @@ -86,7 +86,7 @@ def test_generic_invalid_url(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - 'script_xref(name:"URL", value:"www.example.com");: Invalid URL' " value", + 'script_xref(name:"URL", value:"www.example.com");: Invalid URL value', results[0].message, ) diff --git a/tests/plugins/test_security_messages.py b/tests/plugins/test_security_messages.py index 319c4eef..b54c7232 100644 --- a/tests/plugins/test_security_messages.py +++ b/tests/plugins/test_security_messages.py @@ -84,7 +84,7 @@ def test_nok(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "VT is using a security_message or implementing" " function in a VT without severity", + "VT is using a security_message or implementing function in a VT without severity", results[0].message, ) @@ -106,7 +106,7 @@ def test_nok2(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "VT is using a security_message or implementing " "function in a VT without severity", + "VT is using a security_message or implementing function in a VT without severity", results[0].message, ) @@ -129,7 +129,7 @@ def test_nok3(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "VT is using a security_message or implementing" " function in a VT without severity", + "VT is using a security_message or implementing function in a VT without severity", results[0].message, ) diff --git a/tests/plugins/test_severity_date.py b/tests/plugins/test_severity_date.py index 2ab03d6e..cb57cad1 100644 --- a/tests/plugins/test_severity_date.py +++ b/tests/plugins/test_severity_date.py @@ -10,7 +10,6 @@ class CheckSeverityDateTestCase(PluginTestCase): - def test_severity_date_ok(self): path = Path("some/file.nasl") content = ( diff --git a/tests/plugins/test_severity_format.py b/tests/plugins/test_severity_format.py index 36d82ac7..5d880e62 100644 --- a/tests/plugins/test_severity_format.py +++ b/tests/plugins/test_severity_format.py @@ -10,7 +10,6 @@ class CheckSeverityFormatTestCase(PluginTestCase): - def test_cvss_3_0_vector_ok(self): path = Path("some/file.nasl") content = ( diff --git a/tests/plugins/test_severity_origin.py b/tests/plugins/test_severity_origin.py index bedd6d9f..48e9a896 100644 --- a/tests/plugins/test_severity_origin.py +++ b/tests/plugins/test_severity_origin.py @@ -10,7 +10,6 @@ class CheckSeverityOriginTestCase(PluginTestCase): - def test_severity_origin_nvd(self): path = Path("some/file.nasl") content = ' script_tag(name:"severity_origin", value:"NVD");\n' diff --git a/tests/plugins/test_spaces_before_dots.py b/tests/plugins/test_spaces_before_dots.py index 4c4e8264..91343871 100644 --- a/tests/plugins/test_spaces_before_dots.py +++ b/tests/plugins/test_spaces_before_dots.py @@ -10,7 +10,6 @@ class TestSpacesBeforeDots(PluginTestCase): - def test_ok(self): nasl_file = Path("/some/fake/directory/test.nasl") content = """ diff --git a/tests/plugins/test_using_display.py b/tests/plugins/test_using_display.py index 1a530edc..cedbb1ec 100644 --- a/tests/plugins/test_using_display.py +++ b/tests/plugins/test_using_display.py @@ -98,7 +98,7 @@ def test_using_comment_display(self): def test_using_debug_if_display(self): """Test that display() inside a debug if statement is allowed""" path = Path("some/file.nasl") - content = ' script_tag(name:"cvss_base", value:"4.0");\n' 'if (debug) display("FOO");\n' + content = ' script_tag(name:"cvss_base", value:"4.0");\nif (debug) display("FOO");\n' fake_context = self.create_file_plugin_context(nasl_file=path, file_content=content) plugin = CheckUsingDisplay(fake_context) diff --git a/tests/plugins/test_vt_placement.py b/tests/plugins/test_vt_placement.py index e98415d0..c94e42de 100644 --- a/tests/plugins/test_vt_placement.py +++ b/tests/plugins/test_vt_placement.py @@ -127,6 +127,6 @@ def test_wrong_placement(self): self.assertEqual(len(results), 1) self.assertIsInstance(results[0], LinterError) self.assertEqual( - "VT should be " f"placed in the root directory ({tempdir}).", + f"VT should be placed in the root directory ({tempdir}).", results[0].message, ) diff --git a/tests/standalone_plugins/test_changed_creation_date.py b/tests/standalone_plugins/test_changed_creation_date.py index 2e94a17b..1b39e01d 100644 --- a/tests/standalone_plugins/test_changed_creation_date.py +++ b/tests/standalone_plugins/test_changed_creation_date.py @@ -21,11 +21,9 @@ class TestChangedCreationDate(unittest.TestCase): - @patch("troubadix.standalone_plugins.changed_creation_date.Path.exists") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_check_creation_date_ok(self, mock_git, mock_exists): - mock_git.return_value = ( '-script_tag(name:"creation_date",' ' value:"2025-03-04 10:00:00 +0200 (Tue, 04 Mar 2025)");\n' @@ -40,7 +38,6 @@ def test_check_creation_date_ok(self, mock_git, mock_exists): @patch("troubadix.standalone_plugins.changed_creation_date.Path.exists") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_check_creation_date_fail(self, mock_git, mock_exists): - mock_git.return_value = ( '-script_tag(name:"creation_date",' ' value:"2025-03-04 10:00:00 +0200 (Tue, 04 Mar 2025)");\n' @@ -54,7 +51,6 @@ def test_check_creation_date_fail(self, mock_git, mock_exists): @patch("troubadix.standalone_plugins.changed_creation_date.Path.exists") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_creation_date_not_modified_lines_added(self, mock_git, mock_exists): - mock_git.return_value = ( '-script_tag(name:"creation_date",' ' value:"2025-03-04 10:00:00 +0200 (Tue, 04 Mar 2025)");\n' @@ -69,7 +65,6 @@ def test_creation_date_not_modified_lines_added(self, mock_git, mock_exists): @patch("troubadix.standalone_plugins.changed_creation_date.Path.exists") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_creation_date_not_modified_lines_removed(self, mock_git, mock_exists): - mock_git.return_value = '-script_tag(name:"This got removed", value:"Nothing");' mock_exists.return_value = True @@ -78,7 +73,6 @@ def test_creation_date_not_modified_lines_removed(self, mock_git, mock_exists): @patch("troubadix.standalone_plugins.changed_creation_date.Path.exists") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_creation_date_added_not_removed(self, mock_git, mock_exists): - mock_git.return_value = ( '+script_tag(name:"This got added", value:"Something");\n' '+script_tag(name:"creation_date", ' @@ -98,7 +92,6 @@ def test_git_ok(self): @patch("troubadix.standalone_plugins.changed_creation_date.git") @patch("troubadix.standalone_plugins.changed_creation_date.ArgumentParser.parse_args") def test_args_ok(self, mock_parse_args, mock_git): - mock_parse_args.return_value = Namespace(commit_range="main..test", files=[]) mock_git.return_value = "test1.nasl\ntest2.nasl\ntest3.txt" @@ -121,7 +114,6 @@ def test_main_no_git_repository(self): @patch("troubadix.standalone_plugins.changed_creation_date.os.chdir") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_main_check_creation_date_ok(self, mock_git, _, mock_check_creation_date, __): - mock_git.return_value = "test_directory" mock_check_creation_date.return_value = 0 @@ -132,7 +124,6 @@ def test_main_check_creation_date_ok(self, mock_git, _, mock_check_creation_date @patch("troubadix.standalone_plugins.changed_creation_date.os.chdir") @patch("troubadix.standalone_plugins.changed_creation_date.git") def test_main_check_creation_date_fail(self, mock_git, _, mock_check_creation_date, __): - mock_git.return_value = "test_directory" mock_check_creation_date.return_value = 2 diff --git a/tests/standalone_plugins/test_dependency_graph.py b/tests/standalone_plugins/test_dependency_graph.py index 5928e6e4..6ec9f2a8 100644 --- a/tests/standalone_plugins/test_dependency_graph.py +++ b/tests/standalone_plugins/test_dependency_graph.py @@ -112,7 +112,6 @@ def test_parse_args_defaults(self): class TestDependencyGraph(unittest.TestCase): - def setUp(self) -> None: self.local_root = "tests/standalone_plugins/nasl" self.script_content = """ diff --git a/tests/standalone_plugins/test_deprecate_vts.py b/tests/standalone_plugins/test_deprecate_vts.py index f34b0699..df7c456a 100644 --- a/tests/standalone_plugins/test_deprecate_vts.py +++ b/tests/standalone_plugins/test_deprecate_vts.py @@ -154,8 +154,7 @@ def test_deprecate(self): self.assertNotIn(result, "script_dependencies") self.assertNotIn(result, 'include("revisions-lib.inc");') assert ( - "\n\n Note: This VT has been deprecated and replaced by " - "a Notus scanner based one." + "\n\n Note: This VT has been deprecated and replaced by a Notus scanner based one." ) in result def test_deprecate_with_oid_mapping(self): @@ -222,7 +221,7 @@ def test_deprecate_kb_item(self): ] deprecate(out_dir, to_deprecate, "NOTUS") self.assertLogs( - "Unable to deprecate testfile1.nasl. There are still KB keys " "remaining." + "Unable to deprecate testfile1.nasl. There are still KB keys remaining." ) def test_get_summary(self): @@ -235,7 +234,6 @@ def test_get_summary(self): self.assertEqual(result, expected) def test_finalize_content(self): - result = _finalize_content(NASL_CONTENT) expected = ( '...if(description)\n{\n script_oid("1.3.6.1.4.1.25623.1.0.910673");\n ' diff --git a/tests/standalone_plugins/test_last_modification.py b/tests/standalone_plugins/test_last_modification.py index 21576926..6027dc32 100644 --- a/tests/standalone_plugins/test_last_modification.py +++ b/tests/standalone_plugins/test_last_modification.py @@ -71,8 +71,7 @@ def test_update_invalid_date(self): terminal = MagicMock() with TemporaryDirectory() as tempdir: content = ( - ' script_version("foo");\n' - ' script_tag(name: "last_modification", value: "bar");\n' + ' script_version("foo");\n script_tag(name: "last_modification", value: "bar");\n' ) testfile1 = tempdir / "testfile1.nasl" testfile1.write_text(content, encoding="utf8") diff --git a/tests/test_helper.py b/tests/test_helper.py index fb79751b..f2154e16 100644 --- a/tests/test_helper.py +++ b/tests/test_helper.py @@ -91,7 +91,7 @@ def test_get_path_from_root_absolute(self): # pylint: disable=expression-not-assigned def test_no_root_path(self): with self.assertRaises(ValueError): - get_path_from_root(Path("nasl/foo/bar"), Path("nasl/baz/bar")), + get_path_from_root(Path("nasl/foo/bar"), Path("nasl/baz/bar")) with self.assertRaises(ValueError): - get_path_from_root(Path("/nasl/foo/bar"), Path("/nasl/baz/bar")), + get_path_from_root(Path("/nasl/foo/bar"), Path("/nasl/baz/bar")) diff --git a/tests/test_runner.py b/tests/test_runner.py index fa87147a..dac5335a 100644 --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -184,7 +184,7 @@ def test_runner_run_fail_with_verbose_level_2(self): output, ) self.assertIn( - "Results for plugin " "check_script_version_and_last_modification_tags", + "Results for plugin check_script_version_and_last_modification_tags", output, ) # CI terminal formats for 80 chars per line @@ -243,7 +243,7 @@ def test_runner_run_ok_with_verbose_level_2(self): output = f.getvalue() self.assertIn( - "Checking " f"{get_path_from_root(nasl_file, self.root)}", + f"Checking {get_path_from_root(nasl_file, self.root)}", output, ) self.assertNotIn("No results for plugin check_missing_desc_exit", output) diff --git a/troubadix/helper/date_format.py b/troubadix/helper/date_format.py index 48bc4d24..fa3e753a 100644 --- a/troubadix/helper/date_format.py +++ b/troubadix/helper/date_format.py @@ -56,7 +56,7 @@ def check_date(date: str, date_name: str, file: str, plugin: str) -> Iterator[Li elif week_day_str != week_day_parsed: formatted_date = week_day_parsed yield LinterError( - f"Wrong day of week. Please change it from '{week_day_str}" f"' to '{formatted_date}'.", + f"Wrong day of week. Please change it from '{week_day_str}' to '{formatted_date}'.", file=file, plugin=plugin, ) @@ -65,7 +65,6 @@ def check_date(date: str, date_name: str, file: str, plugin: str) -> Iterator[Li def compare_date_with_last_modification_date( date: str, date_name: str, last_mod_date: str, file: str, plugin: str ) -> Iterator[LinterResult]: - yield from check_date( last_mod_date, "last_modification", @@ -76,7 +75,7 @@ def compare_date_with_last_modification_date( try: if parse_date(date) > parse_date(last_mod_date): yield LinterError( - f"The {date_name} must not be greater than " "last_modification date.", + f"The {date_name} must not be greater than last_modification date.", file=file, plugin=plugin, ) diff --git a/troubadix/plugins/copyright_text.py b/troubadix/plugins/copyright_text.py index 83929514..d0505309 100644 --- a/troubadix/plugins/copyright_text.py +++ b/troubadix/plugins/copyright_text.py @@ -101,7 +101,7 @@ def fix(self) -> Iterator[LinterResult]: nasl_file.write_text(data=self.new_file_content, encoding=CURRENT_ENCODING) yield LinterFix( - f"The copyright statement has been updated to " f"{CORRECT_COPYRIGHT_PHRASE}", + f"The copyright statement has been updated to {CORRECT_COPYRIGHT_PHRASE}", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/dependencies.py b/troubadix/plugins/dependencies.py index 3bb64526..8cc6027d 100644 --- a/troubadix/plugins/dependencies.py +++ b/troubadix/plugins/dependencies.py @@ -77,7 +77,7 @@ def run( for dep in split_dependencies(match.group("value")): if not any((root / vers / dep).exists() for vers in FEED_VERSIONS): yield LinterError( - f"The script dependency {dep} could not " "be found within the VTs.", + f"The script dependency {dep} could not be found within the VTs.", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/dependency_category_order.py b/troubadix/plugins/dependency_category_order.py index 1cd561c4..694da9e2 100644 --- a/troubadix/plugins/dependency_category_order.py +++ b/troubadix/plugins/dependency_category_order.py @@ -132,7 +132,7 @@ def check_content( if not dependency_path: yield LinterError( - f"The script dependency {dep} could not " "be found within the VTs.", + f"The script dependency {dep} could not be found within the VTs.", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/deprecated_dependency.py b/troubadix/plugins/deprecated_dependency.py index 0260eb59..2d8cc0ab 100644 --- a/troubadix/plugins/deprecated_dependency.py +++ b/troubadix/plugins/deprecated_dependency.py @@ -78,7 +78,7 @@ def run(self) -> Iterator[LinterResult]: if not dependency_path: yield LinterError( - f"The script dependency {dep} could not " "be found within the VTs.", + f"The script dependency {dep} could not be found within the VTs.", file=self.context.nasl_file, plugin=self.name, ) @@ -88,7 +88,7 @@ def run(self) -> Iterator[LinterResult]: dependency_deprecated = deprecated_pattern.search(dependency_content) if dependency_deprecated: yield LinterError( - f"VT depends on {dep}, which is marked " "as deprecated.", + f"VT depends on {dep}, which is marked as deprecated.", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/deprecated_functions.py b/troubadix/plugins/deprecated_functions.py index b631db55..77021e50 100644 --- a/troubadix/plugins/deprecated_functions.py +++ b/troubadix/plugins/deprecated_functions.py @@ -44,8 +44,7 @@ def run(self) -> Iterator[LinterResult]: deprecated_functions = { 'script_summary();, use script_tag(name:"summary", value:""); ' "instead": r"script_summary\s*\([^)]*\);", - "script_id();, use script_oid(); with " - "the full OID instead": r"script_id\s*\([0-9]+\);", + "script_id();, use script_oid(); with the full OID instead": r"script_id\s*\([0-9]+\);", "security_note();": r"security_note\s*\([^)]*\);", "security_warning();": r"security_warning\s*\([^)]*\);", "security_hole();": r"security_hole\s*\([^)]*\);", @@ -58,7 +57,7 @@ def run(self) -> Iterator[LinterResult]: for description, pattern in deprecated_functions.items(): if re.search(pattern, self.context.file_content, re.MULTILINE): yield LinterError( - "Found a deprecated function call / description item: " f"{description}", + f"Found a deprecated function call / description item: {description}", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/duplicated_script_tags.py b/troubadix/plugins/duplicated_script_tags.py index 99b07980..2fbbb332 100644 --- a/troubadix/plugins/duplicated_script_tags.py +++ b/troubadix/plugins/duplicated_script_tags.py @@ -81,8 +81,7 @@ def run(self) -> Iterator[LinterResult]: match = list(match) if len(match) > 1: yield LinterError( - f"The VT is using the script tag '{tag.value}' " - "multiple number of times.", + f"The VT is using the script tag '{tag.value}' multiple number of times.", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/grammar.py b/troubadix/plugins/grammar.py index 2a124977..3f406eeb 100644 --- a/troubadix/plugins/grammar.py +++ b/troubadix/plugins/grammar.py @@ -65,7 +65,7 @@ # nb: Valid sentence TextInFileCheck( "2012/gb_VMSA-2010-0007.nasl", - "e. VMware VMnc Codec heap overflow vulnerabilities\n\n" " Vulnerabilities in the", + "e. VMware VMnc Codec heap overflow vulnerabilities\n\n Vulnerabilities in the", ), TextInFileCheck("gb_opensuse_2018_1900_1.nasl", "(Note that"), # e.g.: @@ -135,10 +135,9 @@ def get_grammer_pattern() -> re.Pattern: r"links\s+mentioned\s+in(\s+the)?\s+reference|" r"\s+an?(\s+remote)?(\s+(un)?authenticated)?\s+attackers|" # e.g. "this flaws" - r"this\s+(vulnerabilities|(flaw|error|problem|issue|feature|file|" r"request)s)|" + r"this\s+(vulnerabilities|(flaw|error|problem|issue|feature|file|request)s)|" # e.g. "these flaw " - r"these\s+(vulnerability|(flaw|error|problem|issue|feature|file|" - r"request)\s+)|" + r"these\s+(vulnerability|(flaw|error|problem|issue|feature|file|request)\s+)|" r"\s+or\s+not\.?(\"\);)?$|" r"from(\s+the)?(\s+below)?mentioned\s+References?\s+link|" r"software\s+it\s+fail|" @@ -200,7 +199,7 @@ def get_grammer_pattern() -> re.Pattern: r"in the in the|to an? to a|prior to prior to|to version to version|" r"update to update to|" # e.g. "is prone to a security bypass vulnerabilities" - r"is\s+prone\s+to\s+an?\s+[^\s]+\s+([^\s]+\s+)?vulnerabilities" r").*", + r"is\s+prone\s+to\s+an?\s+[^\s]+\s+([^\s]+\s+)?vulnerabilities).*", re.IGNORECASE, ) @@ -221,7 +220,6 @@ def run(self) -> Iterator[LinterResult]: for match in pattern.finditer(self.context.file_content): if match: - # nb: No strip() here for so that the exclusions can be handled # more strict with e.g. leading or trailing newlines. full_line = match.group(0) diff --git a/troubadix/plugins/http_links_in_tags.py b/troubadix/plugins/http_links_in_tags.py index f90fefa7..5f730765 100644 --- a/troubadix/plugins/http_links_in_tags.py +++ b/troubadix/plugins/http_links_in_tags.py @@ -102,9 +102,8 @@ def contains_nvd_mitre_link_in_xref(self) -> Iterator[LinterResult]: if match: if ( # fmt: off - "nvd.nist.gov/vuln/detail/CVE-" in match.group('ref') - or "cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-" - in match.group('ref') + "nvd.nist.gov/vuln/detail/CVE-" in match.group("ref") + or "cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-" in match.group("ref") # fmt: on ): yield LinterError( diff --git a/troubadix/plugins/illegal_characters.py b/troubadix/plugins/illegal_characters.py index 15ff4376..e4f23a88 100644 --- a/troubadix/plugins/illegal_characters.py +++ b/troubadix/plugins/illegal_characters.py @@ -106,8 +106,7 @@ def run(self) -> Iterator[LinterResult]: for forbidden_char in found_forbidden_characters: result, _ = FORBIDDEN_CHARS[forbidden_char] yield result( - f"Found illegal character '{forbidden_char}' " - f"in {match.group(0)}", + f"Found illegal character '{forbidden_char}' in {match.group(0)}", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/multiple_re_parameters.py b/troubadix/plugins/multiple_re_parameters.py index 13a7c734..a70150c1 100644 --- a/troubadix/plugins/multiple_re_parameters.py +++ b/troubadix/plugins/multiple_re_parameters.py @@ -24,7 +24,6 @@ class CheckMultipleReParameters(LineContentPlugin): name = "check_multiple_re_parameters" def check_lines(self, nasl_file: Path, lines: Iterable[str]) -> Iterator[LinterResult]: - if self.context.nasl_file.suffix == ".inc": return diff --git a/troubadix/plugins/overlong_description_lines.py b/troubadix/plugins/overlong_description_lines.py index 5fe6a57d..0bbba3de 100644 --- a/troubadix/plugins/overlong_description_lines.py +++ b/troubadix/plugins/overlong_description_lines.py @@ -85,7 +85,7 @@ def check_content(self, nasl_file: Path, file_content: str) -> Iterator[LinterRe continue yield LinterWarning( - f"Line {i} is too long" f" with {len(line)} characters. " f"Max 100", + f"Line {i} is too long with {len(line)} characters. Max 100", plugin=self.name, file=nasl_file, line=i, diff --git a/troubadix/plugins/qod.py b/troubadix/plugins/qod.py index 7c72f4f4..b97561a6 100644 --- a/troubadix/plugins/qod.py +++ b/troubadix/plugins/qod.py @@ -101,7 +101,6 @@ def run(self) -> Iterator[LinterResult]: # Check if the value is enclosed in double quotes if full_value.startswith('"') and full_value.endswith('"'): - # Compare against valid values if value not in VALID_QOD_NUM_VALUES: yield LinterError( diff --git a/troubadix/plugins/script_calls_recommended.py b/troubadix/plugins/script_calls_recommended.py index 820377f3..2cf73588 100644 --- a/troubadix/plugins/script_calls_recommended.py +++ b/troubadix/plugins/script_calls_recommended.py @@ -86,7 +86,7 @@ def check_content( file_content ): yield LinterWarning( - "VT does not contain the following recommended call: " f"'script_{call}'", + f"VT does not contain the following recommended call: 'script_{call}'", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/script_family.py b/troubadix/plugins/script_family.py index 2f9e9ac3..5bf15c6b 100644 --- a/troubadix/plugins/script_family.py +++ b/troubadix/plugins/script_family.py @@ -130,7 +130,7 @@ def check_content( if matches[0].group("value") not in VALID_FAMILIES: yield LinterError( - "Invalid or misspelled script family " f"'{matches[0].group('value')}'", + f"Invalid or misspelled script family '{matches[0].group('value')}'", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/script_tag_whitespaces.py b/troubadix/plugins/script_tag_whitespaces.py index 10cdde90..9b72dd1b 100644 --- a/troubadix/plugins/script_tag_whitespaces.py +++ b/troubadix/plugins/script_tag_whitespaces.py @@ -59,8 +59,7 @@ def check_content( r".*\s+$", match.group("value"), flags=re.S ): yield LinterError( - f"{match.group(0)}: value contains a leading or" - " trailing whitespace character", + f"{match.group(0)}: value contains a leading or trailing whitespace character", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/script_tags_mandatory.py b/troubadix/plugins/script_tags_mandatory.py index 85bc056d..d2491e9c 100644 --- a/troubadix/plugins/script_tags_mandatory.py +++ b/troubadix/plugins/script_tags_mandatory.py @@ -69,7 +69,7 @@ def check_content( for tag in MANDATORY_TAGS: if not get_script_tag_pattern(tag).search(file_content): yield LinterError( - "VT does not contain the following mandatory tag: " f"'script_{tag.value}'", + f"VT does not contain the following mandatory tag: 'script_{tag.value}'", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/script_version_and_last_modification_tags.py b/troubadix/plugins/script_version_and_last_modification_tags.py index a3d93f0c..5f1f5fb3 100644 --- a/troubadix/plugins/script_version_and_last_modification_tags.py +++ b/troubadix/plugins/script_version_and_last_modification_tags.py @@ -130,7 +130,7 @@ def check_content( if not match_last_modified: self.fix_last_modification_and_version = True yield LinterError( - "VT is is using a wrong syntax for script_tag(" 'name:"last_modification".', + 'VT is is using a wrong syntax for script_tag(name:"last_modification".', file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/security_messages.py b/troubadix/plugins/security_messages.py index d5ef3aba..81617065 100644 --- a/troubadix/plugins/security_messages.py +++ b/troubadix/plugins/security_messages.py @@ -59,8 +59,7 @@ def _check_security_message_present( if not _file_contains_security_message(file_content): yield LinterError( - "VT is missing a security_message or implementing" - " function in a VT with severity", + "VT is missing a security_message or implementing function in a VT with severity", file=nasl_file, plugin=self.name, ) @@ -81,8 +80,7 @@ def _check_security_message_absent( if _file_contains_security_message(file_content): yield LinterError( - "VT is using a security_message or implementing" - " function in a VT without severity", + "VT is using a security_message or implementing function in a VT without severity", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/severity_date.py b/troubadix/plugins/severity_date.py index 9fa695fb..f83f61c2 100644 --- a/troubadix/plugins/severity_date.py +++ b/troubadix/plugins/severity_date.py @@ -20,7 +20,6 @@ def check_content( nasl_file: Path, file_content: str, ) -> Iterator[LinterResult]: - if nasl_file.suffix == ".inc": return diff --git a/troubadix/plugins/severity_format.py b/troubadix/plugins/severity_format.py index ead34ddb..0212c73e 100644 --- a/troubadix/plugins/severity_format.py +++ b/troubadix/plugins/severity_format.py @@ -16,7 +16,6 @@ def check_content( nasl_file: Path, file_content: str, ) -> Iterator[LinterResult]: - if nasl_file.suffix == ".inc" or "severity_vector" not in file_content: return diff --git a/troubadix/plugins/severity_origin.py b/troubadix/plugins/severity_origin.py index cecaf853..b829ffc7 100644 --- a/troubadix/plugins/severity_origin.py +++ b/troubadix/plugins/severity_origin.py @@ -16,7 +16,6 @@ def check_content( nasl_file: Path, file_content: str, ) -> Iterator[LinterResult]: - if nasl_file.suffix == ".inc" or "severity_origin" not in file_content: return diff --git a/troubadix/plugins/spaces_before_dots.py b/troubadix/plugins/spaces_before_dots.py index a6d9ab85..9155c3d2 100644 --- a/troubadix/plugins/spaces_before_dots.py +++ b/troubadix/plugins/spaces_before_dots.py @@ -101,7 +101,6 @@ def check_content(self, nasl_file: Path, file_content: str) -> Iterator[LinterRe ) def fix(self) -> Iterator[LinterResult]: - if not self.matches: return diff --git a/troubadix/plugins/spaces_in_filename.py b/troubadix/plugins/spaces_in_filename.py index 47e500b2..f4a90177 100644 --- a/troubadix/plugins/spaces_in_filename.py +++ b/troubadix/plugins/spaces_in_filename.py @@ -13,7 +13,7 @@ class CheckSpacesInFilename(FilePlugin): def run(self) -> Iterator[LinterResult]: if re.search(r"\s", self.context.nasl_file.name): yield LinterError( - f"The VT {self.context.nasl_file}" " contains whitespace in the filename", + f"The VT {self.context.nasl_file} contains whitespace in the filename", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/trailing_spaces_tabs.py b/troubadix/plugins/trailing_spaces_tabs.py index c79535b1..e2451c8b 100644 --- a/troubadix/plugins/trailing_spaces_tabs.py +++ b/troubadix/plugins/trailing_spaces_tabs.py @@ -44,7 +44,7 @@ def run(self) -> Iterator[LinterResult]: continue yield LinterError( - "The VT has one or more trailing spaces " f"and/or tabs in line {line_number}!", + f"The VT has one or more trailing spaces and/or tabs in line {line_number}!", file=self.context.nasl_file, plugin=self.name, ) diff --git a/troubadix/plugins/valid_script_tag_names.py b/troubadix/plugins/valid_script_tag_names.py index fc8e5cde..a5f6e904 100644 --- a/troubadix/plugins/valid_script_tag_names.py +++ b/troubadix/plugins/valid_script_tag_names.py @@ -94,7 +94,7 @@ def check_content( for match in matches: if match.group("name") not in allowed_script_tag_names: yield LinterError( - f"The script_tag name '{match.group('name')}' " "is not allowed.", + f"The script_tag name '{match.group('name')}' is not allowed.", file=nasl_file, plugin=self.name, ) diff --git a/troubadix/reporter.py b/troubadix/reporter.py index 2ac5e7e0..35beaf1d 100644 --- a/troubadix/reporter.py +++ b/troubadix/reporter.py @@ -185,7 +185,7 @@ def report_statistic(self) -> None: if self._fix and self._ignore_warnings: line = f"{plugin:48} {count['error']:8} {count['fix']:8}" elif self._fix: - line = f"{plugin:48} {count['error']:8} {count['warning']:8}" f" {count['fix']:8}" + line = f"{plugin:48} {count['error']:8} {count['warning']:8} {count['fix']:8}" elif self._ignore_warnings: line = f"{plugin:48} {count['error']:8}" else: @@ -203,8 +203,7 @@ def report_statistic(self) -> None: if self._fix and self._ignore_warnings: line = ( - f"{'sum':48} {self._result_counts.error_count:8}" - f" {self._result_counts.fix_count:8}" + f"{'sum':48} {self._result_counts.error_count:8} {self._result_counts.fix_count:8}" ) elif self._fix: line = ( diff --git a/troubadix/standalone_plugins/allowed_rev_diff.py b/troubadix/standalone_plugins/allowed_rev_diff.py index fc65549c..c97e296a 100644 --- a/troubadix/standalone_plugins/allowed_rev_diff.py +++ b/troubadix/standalone_plugins/allowed_rev_diff.py @@ -29,7 +29,7 @@ def parse_arguments() -> Namespace: "--directory", default=Path.cwd(), type=Path, - help="The directory the repository to check is located in. " "Defaults to 'pwd'", + help="The directory the repository to check is located in. Defaults to 'pwd'", ) ignored_linestart_group = argument_parser.add_mutually_exclusive_group() @@ -41,7 +41,7 @@ def parse_arguments() -> Namespace: nargs="*", type=str, default=DEFAULT_IGNORED_LINESTARTS, - help="A list of line starts which will make the line be ignored. " "Default: %(default)s", + help="A list of line starts which will make the line be ignored. Default: %(default)s", ) ignored_linestart_group.add_argument( diff --git a/troubadix/standalone_plugins/changed_creation_date.py b/troubadix/standalone_plugins/changed_creation_date.py index 2b989b4a..b96cae36 100644 --- a/troubadix/standalone_plugins/changed_creation_date.py +++ b/troubadix/standalone_plugins/changed_creation_date.py @@ -21,7 +21,6 @@ def parse_arguments() -> Namespace: - parser = ArgumentParser( description="Check for changed creation date", ) @@ -43,8 +42,7 @@ def parse_arguments() -> Namespace: type=file_type_existing, default=[], help=( - "List of files to diff. " - "If empty use all files added or modified in the commit range." + "List of files to diff. If empty use all files added or modified in the commit range." ), ) args = parser.parse_args() @@ -69,7 +67,6 @@ def check_changed_creation_date(commit_range: str, nasl_files: list[Path]) -> bo creation_date_changed = False for nasl_file in nasl_files: - if not nasl_file.exists(): continue @@ -116,7 +113,6 @@ def check_changed_creation_date(commit_range: str, nasl_files: list[Path]) -> bo def main() -> int: - try: git_base = git("rev-parse", "--show-toplevel") os.chdir(git_base.rstrip("\n")) diff --git a/troubadix/standalone_plugins/changed_oid.py b/troubadix/standalone_plugins/changed_oid.py index 71444447..61167d49 100644 --- a/troubadix/standalone_plugins/changed_oid.py +++ b/troubadix/standalone_plugins/changed_oid.py @@ -49,8 +49,7 @@ def parse_args(args: Iterable[str]) -> Namespace: type=file_type_existing, default=[], help=( - "List of files to diff. " - "If empty use all files added or modified in the commit range." + "List of files to diff. If empty use all files added or modified in the commit range." ), ) return parser.parse_args(args=args) diff --git a/troubadix/standalone_plugins/changed_packages/package.py b/troubadix/standalone_plugins/changed_packages/package.py index fcb43ede..ae5ec3ca 100644 --- a/troubadix/standalone_plugins/changed_packages/package.py +++ b/troubadix/standalone_plugins/changed_packages/package.py @@ -75,12 +75,12 @@ def __lt__(self, other: "Package") -> bool: return False def __str__(self) -> str: - result = f"{self.name : <50} {self.version : <40} {self.release : <10}" + result = f"{self.name: <50} {self.version: <40} {self.release: <10}" reasons = ", ".join( - f"{change}" f"{' in new package' if direction == Direction.PASSIVE else ''}" + f"{change}{' in new package' if direction == Direction.PASSIVE else ''}" for change, direction in self.reasons.items() ) - result += f"{reasons : <10}" + result += f"{reasons: <10}" return result diff --git a/troubadix/standalone_plugins/file_extensions.py b/troubadix/standalone_plugins/file_extensions.py index 475265e3..69875d98 100644 --- a/troubadix/standalone_plugins/file_extensions.py +++ b/troubadix/standalone_plugins/file_extensions.py @@ -73,7 +73,7 @@ def main() -> int: print(file.relative_to(args.dir)) return 0 - print(f"{len(unwanted_files)} " "Files with unwanted file extension were found:") + print(f"{len(unwanted_files)} Files with unwanted file extension were found:") for file in unwanted_files: print(file) return 1 diff --git a/troubadix/standalone_plugins/no_solution.py b/troubadix/standalone_plugins/no_solution.py index 7726b2a0..e795c129 100644 --- a/troubadix/standalone_plugins/no_solution.py +++ b/troubadix/standalone_plugins/no_solution.py @@ -97,7 +97,7 @@ def parse_args() -> Namespace: dest="threshold", type=int, default=12, - help="The threshold after which to assume no solution " "will be provided anymore", + help="The threshold after which to assume no solution will be provided anymore", ) parser.add_argument( @@ -239,9 +239,7 @@ def print_report( "No solution should be expected at this point. " ) else: - term.bold_info( - f"{len(vts)} VTs with no solution for " f"more than {milestone} month(s)" - ) + term.bold_info(f"{len(vts)} VTs with no solution for more than {milestone} month(s)") for vt, oid, creation, solution in vts: term.info(str(vt.relative_to(root))) diff --git a/troubadix/standalone_plugins/util.py b/troubadix/standalone_plugins/util.py index 70635d82..8683872e 100644 --- a/troubadix/standalone_plugins/util.py +++ b/troubadix/standalone_plugins/util.py @@ -11,11 +11,9 @@ @contextmanager def temporary_git_directory(): - cwd = Path.cwd() with TemporaryDirectory() as tempdir: - try: chdir(tempdir) git("init", "-b", "main") diff --git a/troubadix/standalone_plugins/version_updated.py b/troubadix/standalone_plugins/version_updated.py index 362f0a34..23e426a1 100644 --- a/troubadix/standalone_plugins/version_updated.py +++ b/troubadix/standalone_plugins/version_updated.py @@ -68,8 +68,7 @@ def parse_args(args: Iterable[str]) -> Namespace: type=file_type_existing, default=[], help=( - "List of files to diff. " - "If empty use all files added or modified in the commit range." + "List of files to diff. If empty use all files added or modified in the commit range." ), ) return parser.parse_args(args=args)