Format Feature

Code formating, using third party tools.

Superseeds “yapf” feature that was only using one tool for one language.

$ make format

Usage

To use the Format Feature, make sure your Projectfile contains the following:

from medikit import require

format = require('format')

The format handle is a FormatConfig instance, and can be used to customize the feature.

Configuration

class medikit.feature.format.FormatConfig[source]
active_tools
all_tools = {'black', 'isort', 'prettier', 'yapf'}
default_tools = {'black', 'isort'}
javascript_tools = {'prettier'}
python_tools = {'black', 'isort', 'yapf'}
using(*tools)[source]

Choose which tool to use when formatting the codebase.

Example:

require("format").using("yapf", "isort")

Note that the above is also the default, so using require(“format”) is enough to have the same effect.

Implementation

class medikit.feature.format.FormatFeature(dispatcher)[source]
Config

alias of FormatConfig

conflicts = {'yapf'}
on_before_start(event)[source]

Listens to medikit.on_start event (priority: -101)

on_make_generate(event)[source]

Listens to medikit.feature.make.on_generate event (priority: -20)

on_python_generate(event)[source]

Listens to medikit.feature.python.on_generate event (priority: 0)

on_start(event)[source]

Listens to medikit.on_start event (priority: -20)