pylint和autopep8配置流程

pylint和autopep8配置流程

1、pylint

  • 安装
pip install pylint
  • 查看版本信息
pylint --version
  • 使用
#pylint + 目标项目或者文件
pylint verify_paddle_install.py
  • 输出
------------------------------------
Your code has been rated at 10.00/10
  • 输出阐述

    • 使用pylint有如下几种提示级别Error(错误)、Warning(警告)、Refactor(重构)、Convention(规范)

    • 输出的结果包括:与规范冲突的位置(行列)、违反的规范编号以及具体的内容提示,还有一个有趣的地方,就是会给检查项目打分,满分10分,大家可以试试自己的项目,看看编码规范评分是多少

    • 从检查信息可以看到,上述代码缺少模块注释(Missing module docstring)以及函数注释(Missing function docstring),函数名不符合蛇形命名规范(全由小写字母和下划线组成,在两个单词之间用下滑线连接)

  • pylint的5种信息类型

Output:
   Using the default text output, the message format is :
  MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE
  There are 5 kind of message types :
  * (C) convention, for programming standard violation
  * (R) refactor, for bad code smell
  * (W) warning, for python specific problems
  * (E) error, for probable bugs in the code
  * (F) fatal, if an error occurred which prevented pylint from doing further processing.

* (C) 约定,用于违反编程标准
* (R) 重构,针对糟糕的代码味道
* (W) 警告,针对 python 特定问题
* (E) 错误,用于代码中可能的错误
* (F) 致命的,如果发生错误导致 pylint 无法进行进一步处理。
  • pylint官网
    • https://pylint.readthedocs.io/en/latest/

2、autopep8

  • 作用:建议代码书写格式
  • 代码自动格式化
    • ctrl + s 即可实现
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值