当前位置:网站首页>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.
边栏推荐
- Debug 调式程序
- 开源一夏|Flutter实现搜索的三种方式
- [Image Classification] 2021-CoAtNet NeurlPS
- 1252_FreeRTOS_堆栈溢出检查方法与测试
- 各种attention的代码实现
- Database Tuning: The Impact of Mysql Indexes on Group By Sorting
- 移动端/嵌入式-CV模型-2017:MobelNets-v1
- 小白求助,关于Go编译的顺序
- Offensive and defensive world - lottery
- Is it safe to buy stocks with a straight flush?Will the funds be transferred?
猜你喜欢

LVS负载均衡群集及NAT模式群集

推荐系统 使用surprise库基于协同过滤的方法实现

DVWA full level detailed customs clearance tutorial

Recommended download software
![[Image Classification] 2021-CoAtNet NeurlPS](/img/e6/c1b9d10dc1605ab568d59f082ac419.png)
[Image Classification] 2021-CoAtNet NeurlPS

MySQL中的锁机制详解

Database Tuning: The Impact of Mysql Indexes on Group By Sorting

数学基础(一)矩阵对角化、SVD分解以及应用

移动端/嵌入式-CV模型-2018:MobelNets-v2

2022 - image classification 】 【 MaxViT ECCV
随机推荐
中原银行实时风控体系建设实践
文献学习(part33)--Clustering by fast search and find of density peaks
Flink Record has Long.MIN_VALUE timestamp (= no timestamp marker). Is the time characteristic
jupyter lab内终端从sh变为bin/bash(切换conda操作)
Practical Case: Building Churn Prediction Models with PySpark ML
攻防世界——fakebook
机器学习理论及案例分析(part3)--聚类
Golang实现sha256或sha512加密
移动端/嵌入式-CV模型-2018:MobileFaceNets
PCBA电路板为什么需要使用三防漆,有何作用?
Open source summer | Three ways to implement search in Flutter
Database Tuning: The Impact of Mysql Indexes on Group By Sorting
数据库调优:Mysql索引对group by 排序的影响
入职半个月的一些思考
买股票用同花顺安全吗?资金会不会被转走?
实体List转为excel
手机APP测试流程规范和方法你知道多少?
各种attention的代码实现
等式变换(2015届华为校园招聘机试题第三题 )
Redis读写分离(三)