跳转到主要内容

使用formate配合black。

项目描述

使用formate配合black。

测试

Linux Test Status Windows Test Status macOS Test Status Coverage

PyPI

PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel

活动

GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads

质量保证

CodeFactor Grade Flake8 Status mypy status

其他

License GitHub top language Requirements Status

安装

formate-black 可从PyPI安装。

使用 pip 安装

$ python -m pip install formate-black

钩子

formate-blackformate 提供一个钩子,允许使用 black 代码格式化工具。

black

调用 black,使用给定的关键字参数作为其配置。

此钩子仅接受关键字参数。

最大行长度可以通过 line_length 关键字参数或在 config 表中作为 line_length 提供。

缩进也可以通过 use_tabs 关键字参数或配置表中的 indent 设置为制表符。

示例配置

[hooks]
reformat-generics = 40
collections-import-rewrite = 20
noqa-reformat = 60
ellipsis-reformat = 70

[hooks.black]
priority = 50

[hooks.black.kwargs]
string_normalization = false
magic_trailing_comma = false

[config]
indent = "\t"
line_length = 115

支持