1

I would like to run all tasks even if some have non-zero exit status. I can do this with doit --continue from the command line, but would like to embed the directive in the dodo.py file itself. I've checked the docs but have been unable to find a way - my starting point is:

def task_lint():
    """Run checks on code."""
    return {
        "actions": [
            "pflake8",
            "isort --check .",
            "black --check ."
        ]
    }

In Make I would prefix commands with -:

check:
        -flake8
        -isort --check .
        -black --check .

What should I do in doit?

Greg Wilson
  • 1,015
  • 10
  • 24

1 Answers1

1
DOIT_CONFIG = {
    "continue": True,
}


def task_lint():
    """Run checks on code."""
    yield {
        "name": "flake8",
        "actions": ["flake8"],
    }

    yield {
        "name": "isort",
        "actions": ["isort --check ."],
    }

    yield {
        "name": "black",
        "actions": ["black  --check ."],
    }

Notes:

  1. --continue is for tasks, not actions. Your example is better written as 3 separate tasks. That also allows you to execute them individually (doit lint:flake8).

  2. use DOIT_CONFIG to pass configuration (could also be done on INI or TOML files). Notice that doit help run command will display the config name to be used.

schettino72
  • 2,990
  • 1
  • 28
  • 27
  • Thank you - if I only want `continue: True` for this task, and want other tasks to halt if any of their actions fail, how do I configure that? I've looked through the docs on pydoit.org but can't find that. (Is there a section in pydoit.org docs that documents all available configuration options?) – Greg Wilson Apr 02 '22 at 10:50
  • `--continue` can be applied only globally. Of course inside on your own task you can control what is considered a failure... – schettino72 Apr 02 '22 at 12:25
  • Full list of configuration options is only available per command through the CLI at the moment. I plan to add a section on docs, but that's low priority at the moment. – schettino72 Apr 02 '22 at 12:26