Skip to content

Commit

Permalink
Add docstrings and type hints to provisioner (#4319)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos authored Nov 20, 2024
1 parent 254d898 commit 8de7900
Show file tree
Hide file tree
Showing 21 changed files with 506 additions and 336 deletions.
57 changes: 0 additions & 57 deletions .config/pydoclint-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,63 +95,6 @@ src/molecule/model/schema_v3.py
DOC103: Function `validate`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [c: ].
DOC201: Function `validate` does not have a return section in docstring
--------------------
src/molecule/provisioner/ansible.py
DOC106: Method `Ansible.__init__`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Ansible.__init__`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC106: Method `Ansible.converge`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Ansible.converge`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `Ansible.converge`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [**kwargs: ]. Arguments in the docstring but not in the function signature: [kwargs: ].
DOC101: Method `Ansible.side_effect`: Docstring contains fewer arguments than in function signature.
DOC106: Method `Ansible.side_effect`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Ansible.side_effect`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `Ansible.side_effect`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [action_args: ].
DOC101: Method `Ansible.verify`: Docstring contains fewer arguments than in function signature.
DOC106: Method `Ansible.verify`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Ansible.verify`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `Ansible.verify`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [action_args: ].
DOC201: Method `Ansible.verify` does not have a return section in docstring
DOC106: Method `Ansible._get_ansible_playbook`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Ansible._get_ansible_playbook`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `Ansible._get_ansible_playbook`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [**kwargs: ]. Arguments in the docstring but not in the function signature: [kwargs: ].
DOC201: Method `Ansible._get_ansible_playbook` does not have a return section in docstring
DOC201: Method `Ansible._vivify` does not have a return section in docstring
DOC201: Method `Ansible._get_modules_directories` does not have a return section in docstring
DOC201: Method `Ansible._get_filter_plugins_directories` does not have a return section in docstring
--------------------
src/molecule/provisioner/ansible_playbook.py
DOC106: Method `AnsiblePlaybook.__init__`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybook.__init__`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC201: Method `AnsiblePlaybook.bake` does not have a return section in docstring
DOC101: Method `AnsiblePlaybook.execute`: Docstring contains fewer arguments than in function signature.
DOC106: Method `AnsiblePlaybook.execute`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybook.execute`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `AnsiblePlaybook.execute`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [action_args: ].
DOC106: Method `AnsiblePlaybook.add_cli_arg`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybook.add_cli_arg`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC106: Method `AnsiblePlaybook.add_env_arg`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybook.add_env_arg`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
--------------------
src/molecule/provisioner/ansible_playbooks.py
DOC106: Method `AnsiblePlaybooks.__init__`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybooks.__init__`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC101: Method `AnsiblePlaybooks._get_playbook`: Docstring contains fewer arguments than in function signature.
DOC106: Method `AnsiblePlaybooks._get_playbook`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybooks._get_playbook`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `AnsiblePlaybooks._get_playbook`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [section: ].
DOC201: Method `AnsiblePlaybooks._get_playbook` does not have a return section in docstring
DOC101: Method `AnsiblePlaybooks._normalize_playbook`: Docstring contains fewer arguments than in function signature.
DOC106: Method `AnsiblePlaybooks._normalize_playbook`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `AnsiblePlaybooks._normalize_playbook`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC103: Method `AnsiblePlaybooks._normalize_playbook`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [playbook: ].
DOC201: Method `AnsiblePlaybooks._normalize_playbook` does not have a return section in docstring
--------------------
src/molecule/provisioner/base.py
DOC601: Class `Base`: Class docstring contains fewer class attributes than actual class attributes. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
DOC603: Class `Base`: Class docstring attributes are different from actual class attributes. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Attributes in the class definition but not in the docstring: [__metaclass__: ]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
DOC106: Method `Base.__init__`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Base.__init__`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC202: Method `Base.name` has a return section in docstring, but there are no return statements or annotations
--------------------
src/molecule/verifier/base.py
DOC601: Class `Verifier`: Class docstring contains fewer class attributes than actual class attributes. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
DOC603: Class `Verifier`: Class docstring attributes are different from actual class attributes. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Attributes in the class definition but not in the docstring: [__metaclass__: ]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
Expand Down
4 changes: 2 additions & 2 deletions src/molecule/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def _setup(self) -> None:
"""Prepare Molecule's provisioner and returns None."""
self._config.write()
if self._config.provisioner is not None:
self._config.provisioner.write_config() # type: ignore[no-untyped-call]
self._config.provisioner.manage_inventory() # type: ignore[no-untyped-call]
self._config.provisioner.write_config()
self._config.provisioner.manage_inventory()


def execute_cmdline_scenarios(
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
action_args: Arguments for this command. Unused.
"""
if self._config.provisioner is not None:
self._config.provisioner.check() # type: ignore[no-untyped-call]
self._config.provisioner.check()


@base.click_command_ex()
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
LOG.warning(msg)
return

self._config.provisioner.cleanup() # type: ignore[no-untyped-call]
self._config.provisioner.cleanup()


@base.click_command_ex()
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/converge.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
action_args: Arguments for this command. Unused.
"""
if self._config.provisioner:
self._config.provisioner.converge() # type: ignore[no-untyped-call]
self._config.provisioner.converge()
self._config.state.change_state("converged", value=True)


Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
return

if self._config.provisioner:
self._config.provisioner.create() # type: ignore[no-untyped-call]
self._config.provisioner.create()

self._config.state.change_state("created", value=True)

Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
return

if self._config.provisioner:
self._config.provisioner.destroy() # type: ignore[no-untyped-call]
self._config.provisioner.destroy()
self._config.state.reset()


Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/idempotence.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
util.sysexit_with_message(msg)

if self._config.provisioner:
output = self._config.provisioner.converge() # type: ignore[no-untyped-call]
output = self._config.provisioner.converge()

idempotent = self._is_idempotent(output)
if idempotent:
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
LOG.warning(msg)
return

self._config.provisioner.prepare() # type: ignore[no-untyped-call]
self._config.provisioner.prepare()
self._config.state.change_state("prepared", value=True)


Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/side_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def execute(self, action_args: list[str] | None = None) -> None:
LOG.warning(msg)
return

self._config.provisioner.side_effect(action_args) # type: ignore[no-untyped-call]
self._config.provisioner.side_effect(action_args)


@base.click_command_ex()
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def execute(self, action_args: list[str] | None = None) -> None: # noqa: ARG002
action_args: Arguments for this command. Unused.
"""
if self._config.provisioner:
self._config.provisioner.syntax() # type: ignore[no-untyped-call]
self._config.provisioner.syntax()


@base.click_command_ex()
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def write(self) -> None: # noqa: D102
@property
def ansible_collections_path(
self,
) -> Literal["ANSIBLE_COLLECTIONS_PATH", "ANSIBLE_COLLECTIONS_PATHS"]:
) -> str:
"""Return collection path variable for current version of Ansible."""
# https://github.com/ansible/ansible/pull/70007
if self.runtime.version >= Version("2.10.0.dev0"):
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/provisioner/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# D104 # noqa: D104, ERA001
# noqa: D104
Loading

0 comments on commit 8de7900

Please sign in to comment.