禁止格式化的fs8插件

flake8-printf-formatting的Python项目详细描述


PyPI versionSupported Python versionsBuild statusCoverage

flake8打印格式

flake8插件,禁止printf样式的字符串格式

安装

pip install flake8-printf-formatting

代码

CodeDescription
MOD001do 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]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java是从此类字符串中提取数据的最佳方法   filenotfoundexception Java FileOutputStream Windows/Linux   java在SQLite数据库Android SDK中搜索特定字符串   java使用键值访问jsp中Map<Long,Map<String,Object>>的内容   java奇怪的HTMLeditor工具包问题   在java中使用数组只计算字母   每个应用程序都可以有自己独立的Java SDK吗   java如何将jasper报告生成的PDF文件保存在一个项目文件夹中   java BigDecimal包装器:静态字段为零   解码Base64图像时出现java IllegalArgumentException(非法的Base64字符)   将int转换为字节在Java和Actionscript中产生不同的结果   java什么使不可变对象在没有安全发布技术的情况下发布?   java将字节数据写入目录   一个计算器中有多个操作的java问题   面向对象Java重写是如何工作的   带hibernate的java ClassCastException   指向最后一个对象的java对象列表   java单元测试spring项目中的Get请求