From 85bafd1bde7e85c5d70714eea891707ac59f1111 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle Date: Thu, 20 Apr 2023 18:20:27 +0530 Subject: [PATCH] Fix for 'implicit-str-concat' & 'inconsistent-return-statements' rule --- pyproject.toml | 2 -- src/molecule/config.py | 2 ++ src/molecule/provisioner/ansible.py | 2 +- src/molecule/provisioner/ansible_playbooks.py | 1 + src/molecule/test/unit/command/init/test_scenario.py | 2 +- src/molecule/test/unit/dependency/ansible_galaxy/test_roles.py | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 08c619b077..c0fd768013 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -147,9 +147,7 @@ disable = [ "dangerous-default-value", "duplicate-code", "fixme", - "implicit-str-concat", "import-outside-toplevel", - "inconsistent-return-statements", "invalid-name", "line-too-long", "logging-format-interpolation", diff --git a/src/molecule/config.py b/src/molecule/config.py index 01d8e6d358..e23babda06 100644 --- a/src/molecule/config.py +++ b/src/molecule/config.py @@ -176,6 +176,8 @@ def dependency(self): return ansible_galaxy.AnsibleGalaxy(self) elif dependency_name == "shell": return shell.Shell(self) + else: + return None @cached_property def driver(self): diff --git a/src/molecule/provisioner/ansible.py b/src/molecule/provisioner/ansible.py index 2fd2fa65ce..cabbfaddf0 100644 --- a/src/molecule/provisioner/ansible.py +++ b/src/molecule/provisioner/ansible.py @@ -947,7 +947,7 @@ def _verify_inventory(self): :return: None """ if not self.inventory: - msg = "Instances missing from the 'platform' " "section of molecule.yml." + msg = "Instances missing from the 'platform' " + "section of molecule.yml." util.sysexit_with_message(msg) def _get_config_template(self): diff --git a/src/molecule/provisioner/ansible_playbooks.py b/src/molecule/provisioner/ansible_playbooks.py index de0dfed43d..0df09812ce 100644 --- a/src/molecule/provisioner/ansible_playbooks.py +++ b/src/molecule/provisioner/ansible_playbooks.py @@ -105,6 +105,7 @@ def _get_playbook(self, section): "verify", ]: return playbook + return None def _get_bundled_driver_playbook(self, section): path = self._config.driver.get_playbook(section) diff --git a/src/molecule/test/unit/command/init/test_scenario.py b/src/molecule/test/unit/command/init/test_scenario.py index 45ca933540..a88e47f096 100644 --- a/src/molecule/test/unit/command/init/test_scenario.py +++ b/src/molecule/test/unit/command/init/test_scenario.py @@ -71,7 +71,7 @@ def test_execute_scenario_exists(temp_dir, _instance, patched_logger_critical): assert e.value.code == 1 - msg = "The directory molecule/test-scenario exists. " "Cannot create new scenario." + msg = "The directory molecule/test-scenario exists. Cannot create new scenario." patched_logger_critical.assert_called_once_with(msg) diff --git a/src/molecule/test/unit/dependency/ansible_galaxy/test_roles.py b/src/molecule/test/unit/dependency/ansible_galaxy/test_roles.py index 4bfb39a4fd..a12ac6e9cd 100644 --- a/src/molecule/test/unit/dependency/ansible_galaxy/test_roles.py +++ b/src/molecule/test/unit/dependency/ansible_galaxy/test_roles.py @@ -29,7 +29,7 @@ @pytest.fixture() def _patched_ansible_galaxy_has_requirements_file(mocker): m = mocker.patch( - "molecule.dependency.ansible_galaxy.roles." "Roles._has_requirements_file", + "molecule.dependency.ansible_galaxy.roles." + "Roles._has_requirements_file", ) m.return_value = True