From a34bd5a89686633dcece65dd23b88074ee03d206 Mon Sep 17 00:00:00 2001 From: Kate Case Date: Tue, 29 Oct 2024 14:43:36 -0400 Subject: [PATCH] Update matrix command --- .config/pydoclint-baseline.txt | 6 ------ src/molecule/command/matrix.py | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.config/pydoclint-baseline.txt b/.config/pydoclint-baseline.txt index 48cb89f3d8..e5e382f824 100644 --- a/.config/pydoclint-baseline.txt +++ b/.config/pydoclint-baseline.txt @@ -14,12 +14,6 @@ src/molecule/command/init/scenario.py DOC107: Function `scenario`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints DOC103: Function `scenario`: 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: [ctx: , dependency_name: , driver_name: , provisioner_name: , scenario_name: ]. -------------------- -src/molecule/command/matrix.py - DOC101: Function `matrix`: Docstring contains fewer arguments than in function signature. - DOC106: Function `matrix`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature - DOC107: Function `matrix`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints - DOC103: Function `matrix`: 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: [ctx: , scenario_name: , subcommand: ]. --------------------- src/molecule/command/prepare.py DOC101: Method `Prepare.execute`: Docstring contains fewer arguments than in function signature. DOC106: Method `Prepare.execute`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature diff --git a/src/molecule/command/matrix.py b/src/molecule/command/matrix.py index fad1ffad24..febab0ee4b 100644 --- a/src/molecule/command/matrix.py +++ b/src/molecule/command/matrix.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: - from molecule.types import CommandArgs + from molecule.types import CommandArgs, MoleculeArgs LOG = logging.getLogger(__name__) @@ -79,9 +79,19 @@ class Matrix(base.Base): # NOTE(retr0h): Cannot introspect base.Base for `click.Choice`, since # subclasses have not all loaded at this point. @click.argument("subcommand", nargs=1, type=click.UNPROCESSED) -def matrix(ctx, scenario_name, subcommand): # type: ignore[no-untyped-def] # pragma: no cover # noqa: ANN001, ANN201 - """List matrix of steps used to test instances.""" - args = ctx.obj.get("args") +def matrix( + ctx: click.Context, + scenario_name: str, + subcommand: str, +) -> None: # pragma: no cover + """List matrix of steps used to test instances. + + Args: + ctx: Click context object holding commandline arguments. + scenario_name: Name of the scenario to target. + subcommand: Subcommand to target. + """ + args: MoleculeArgs = ctx.obj.get("args") command_args: CommandArgs = {"subcommand": subcommand} s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name)