Introduction

Misaki is a simple program that runs code linters or formatters (or other utilities) on your code. Features:

  • File matching patterns.
  • Can run as a pre-commit hook.
  • Allows you to locally override configuration variables (such as where commands are found, if you have them installed in virtualenvs or something).
  • Never downloads and installs packages off the Internet (no PyPI, no Github), in stark contrast to pre-commit.

Quickstart

In the root of your git or fossil repository, add a file “.misaki.0.yaml” containing:

pattern:
  - python: 're:\.pyi?$'

tool:
  black:
    config:
      line-length: 80
    pattern: "python"
  flake8:
    pattern: "python"

Now you can run misaki --run-linters --run-formatters whenever you want to run the linters and formatters on all Python files. Well done.

Advanced usage

Run black only on files that are listed as modified by version control:

misaki --run=black --vc-changed

Run all linters and formatters, only on files that changed in version control:

misaki --run-linters --run-formatters --vc-changed

List files that were changed by version control:

misaki --list-files --vc-changed

List files matching the “python” pattern that were changed by version control, one per line:

misaki --list-files --vc-changed --pattern=python

Run flake8 on all applicable files with the --show-source option:

misaki --run=flake8 --set=flake8.config.show-source=true ## DOESN'T WORK YET

Name origin

This package cleans code. Maids do cleaning. Misaki is a maid. This package is named after Misaki.