大家好,又见面了,我是你们的朋友全栈君。
一.概述 flake8(代码规范利器)是下面三个工具的封装: 1)PyFlakes 2)Pep8 3)NedBatchelder’s McCabe script
二.安装
pip install flake8
三.使用
(rd) ➜ web git:(develop) ✗ flake8 views.py # 检查一个文件
views.py:1:1: E265 block comment should start with '# '
views.py:23:80: E501 line too long (117 > 79 characters)
views.py:56:32: E261 at least two spaces before inline comment
views.py:56:32: E262 inline comment should start with '# '
views.py:62:32: E265 block comment should start with '# '
views.py:63:32: E265 block comment should start with '# '
views.py:82:80: E501 line too long (82 > 79 characters)
views.py:100:39: E251 unexpected spaces around keyword / parameter equals
views.py:111:65: E231 missing whitespace after ':'
views.py:111:80: E501 line too long (113 > 79 characters)
views.py:123:80: E501 line too long (96 > 79 characters)
(rd) ➜ web git:(develop) ✗ flake8 # 检查一个项目的所有文件
./common.py:16:23: F841 local variable 'e' is assigned to but never used
./settings.py:12:1: F401 'src.conf.GlobalConf.UPLOAD_PATH' imported but unused
./settings.py:12:1: F401 'src.conf.GlobalConf.LOGIN_URL' imported but unused
./settings.py:89:80: E501 line too long (80 > 79 characters)
./settings.py:131:80: E501 line too long (96 > 79 characters)
./settings.py:146:80: E501 line too long (81 > 79 characters)
./settings.py:186:80: E501 line too long (88 > 79 characters)
./settings.py:223:80: E501 line too long (93 > 79 characters)
./urls.py:25:80: E501 line too long (80 > 79 characters)
./urls.py:29:80: E501 line too long (90 > 79 characters)
./urls.py:32:23: E124 closing bracket does not match visual indentation
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/194242.html原文链接:https://javaforall.cn