Skip to content

Unexpected argument interactions between ref, positional arguments, and switch tasks #313

@Kaelten

Description

@Kaelten

I'm on 0.35.0 and given the below chunk of config, I get unexpected argument behaviors. Specifically

positional arguments not passing along

poe check-all services/some/source/file.py

This still results in the sequenced commands getting evoked as:
ruff check --output-format grouped services shared stubs

fix parameter not getting passed to the switch task

poe check-all --fix

This one is fun because it works for the lint step:
ruff check --fix --output-format grouped services shared stubs

but not the format step

Poe <= fix
Poe => ruff format --check services shared stubs

I don't think I'm doing anything incorrectly, but that's a distinct possibility. Might be worth noting this is running under uv as well.

Config snippet

[tool.poe.tasks.check-all]
help = "runs linting, format, and type checking"
ignore_fail = "return_non_zero"
args = [
    { name = "target", positional = true, multiple = true, default = "services shared stubs", help = "target file(s) or folder(s)" },
    { name = "fix", options = ["--fix"], type = "boolean", help = "automatically fix issues that can be" }
]
sequence = ["lint", "check-types", "check-format"]

[tool.poe.tasks.lint]
help = "check for linting issues"
args = [
    { name = "target", positional = true, multiple = true, default = "services shared stubs", help = "target file(s) or folder(s)" },
    { name = "format", default = "grouped", help = "which format to display output in" },
    { name = "fix", options = ["--fix"], type = "boolean", help = "automatically fix linting issues" }
]
cmd = "ruff check ${fix:+--fix} --output-format ${format} ${target}"

[tool.poe.tasks.check-format]
help = "check for formatting issues"
args = [
    { name = "target", positional = true, multiple = true, default = "services shared stubs", help = "target file(s) or folder(s)" },
    { name = "fix", options = ["--fix"], type = "boolean", help = "automatically fix formatting issues" }
]
control.expr = "fix"
switch = [
    { case = "True", cmd = "ruff format ${target}" },
    { cmd = "ruff format --check ${target}" }
]

[tool.poe.tasks.check-types]
help = "check for type issues with mypy"
args = [
    # TODO: update the default once things are more fleshed out
    { name = "target", positional = true, multiple = true, default = "services", help = "target file(s) or folder(s)" },
]
cmd = "mypy $target"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions