禁止格式化的fs8插件
flake8-printf-formatting的Python项目详细描述
flake8打印格式
flake8插件,禁止printf样式的字符串格式
安装
pip install flake8-printf-formatting
代码
Code | Description |
---|---|
MOD001 | do not use printf-style string formatting |
基本原理
Python3的官方文档doesn't recommend 打印样式字符串格式:
The formatting operations described here exhibit a variety of quirks that lead to a number of common errors (such as failing to display tuples and dictionaries correctly). Using the newer formatted string literals, the
str.format
interface, or template strings may help avoid these errors. Each of these alternatives provides their own trade-offs and benefits of simplicity, flexibility, and/or extensibility.
作为提交前挂钩
有关说明,请参阅pre-commit
示例.pre-commit-config.yaml
:
-repo:https://gitlab.com/pycqa/flake8rev:3.7.8hooks:-id:flake8additional_dependencies:[flake8-printf-formatting]
- 项目
标签: