当前位置:网站首页>code inspection tool
code inspection tool
2022-08-08 09:31:00 【User 9127725】
Python is good everywhere, but too much indentation and too much nesting can easily cause syntax errors that are difficult to check, so we need a static checking software
Here introduces a static check tool: flake8.
Introduction to flake8
It is a wrapper for the following three tools:
PyFlakes: python source code check: redundant import; duplicate function definition; variable name conflict...
Pep8: Code Style Check
Ned Batchelder's McCabe script: Code Complexity Check
Three functions:
Python code style check, so that the project meets a good code style, and it is easy to find problems.
Some basic code checks.
git integration
flake8 use
Install: pip install flake8
Check: flake8 [python source directory or file]
Ignore rule contact, there are two main ways:
Ignore the static check of the entire file, add a comment: # flake8: noqa
Ignore certain errors, you can modify setup.cfg (eg ignore E265 rules):
[flake8]
ignore = E265
git integration: The flake8 check is automatically done before git commits, and the commit can only be done after the check is successful. Under the local git branch, perform the following two steps:
- flake8 --install-hook
- git config flake8.strict true
The principle of flake8 git integration: bury git hooks. (.git/hooks/pre-commit)
Other tools
pylint: The rules are relatively dead, and a lot of errors will be produced. It is difficult to ensure that there are no errors. It is not suitable for our project.
pycharm: comes with pep8, pyflake check, and can also integrate flake8. Recommended editor
Radon: Complexity Check.
边栏推荐
- Implementation principle of priority queue
- 什么是本质安全?
- 安装oracle19c时报错DBT-50000
- 攻防世界——ics-05
- flink sql创建表成功,查询却报错block data,大家有没有碰到这现象
- HyperLynx(三)传输线类型及相关设置
- 分门别类输入输出,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang基本数据类型和输入输出EP03
- Practical Case: Building Churn Prediction Models with PySpark ML
- Recommended download software
- Golang实现sha256或sha512加密
猜你喜欢

Excel中text函数5中常用方法

ACWing 198. Antiprime Problem Solution

nodeJs--egg框架介绍

数学基础(二)逆矩阵、伪逆矩阵、最小二乘解、最小范数解

Offensive and defensive world - ics-05

交换两个整型变量的三种方法

Literature Learning (part33)--Clustering by fast search and find of density peaks

你一定要看的安装及卸载测试用例的步骤及方法总结

Offensive and defensive world - web2

Techwiz OLED:偏振片的发射特性
随机推荐
使用分类权重,轻松解决数据不平衡的问题
STL underlying implementation principle
等式变换(2015届华为校园招聘机试题第三题 )
docker部署redis容器问题
Implementation principle of priority queue
软考证书含金量
移动端/嵌入式-CV模型-2018:MobelNets-v2
小白求助,关于Go编译的顺序
.json()的使用
干货 | Oracle数据库操作命令大全,满满的案例供你理解,收藏!
LVS负载均衡群集
【AGC】开放式测试示例
Excel method is commonly used in text function 5
Debug 调式程序
字节与字符与常见编码方式
LVS负载均衡群集及NAT模式群集
Recommend 100 nice English songs
Today share how to submit a bug
Is it safe to buy stocks with a straight flush?Will the funds be transferred?
实战案例:用 PySpark ML 构建流失预测模型