1、Pylint是什么

pylint是一个Python源代码中查找bug的工具,能找出错误,和代码规范的运行。也就是你的代码有Error错误的时候能找出来错误,没有错误的时候,能根据Python代码规范给你建议修改代码,让代码变更美观。
 
2、安装pylint
 pip3 install pylint
3、查找pylint的安装地址
$ which pylint
/Library/Frameworks/Python.framework/Versions/3.9/bin/pylint
 
4、Pycharm使用Pylint工具
 
1)Pycharm --> Preferences --> Tools --> External Tools --> + 
 
 
Program:pylint的地址,可以通过which pylint找到地址
Arguments:pylint运行的参数
 
2)使用
 
 
 
3)得到的结果
 
************* Module 704
leetcode/704.py:28:0: C0305: Trailing newlines (trailing-newlines) #文尾有多余的行
leetcode/704.py:1:0: C0114: Missing module docstring (missing-module-docstring) # 脚本首行没有添加注释
leetcode/704.py:4:11: W0621: Redefining name 'nums' from outer scope (line 23) (redefined-outer-name) #变量名字与函数参数名字不能一样
leetcode/704.py:4:28: W0621: Redefining name 'target' from outer scope (line 24) (redefined-outer-name) #变量名字与函数参数名字不能一样
leetcode/704.py:4:0: C0116: Missing function or method docstring (missing-function-docstring) #函数缺少注释,注释要放在函数的第一行而不是def的上面
5、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 无法进行进一步处理。
 
6、更多的pylint信息
 
1)可以通过命令行获取
 
pylint --list-msgs

2)官网

http://pylint.pycqa.org/en/latest/#

Python语言规范之Pylint的使用的更多相关文章

  1. google的python语言规范

    Python语言规范   Lint Tip 对你的代码运行pylint 定义: pylint是一个在Python源代码中查找bug的工具. 对于C和C++这样的不那么动态的(译者注: 原文是less ...

  2. Python 语言规范(Google)

    Python语言规范 Lint tip 对你的代码运行pylint 定义: pylint是一个在Python源代码中查找bug的工具. 对于C和C++这样的不那么动态的(译者注: 原文是less dy ...

  3. Python 语言规范

    Python 语言规范 pychecker  对你的代码运行pychecker 定义: pychecker 是一个在Python 源代码中查找bug 的工具. 对于C 和C++这样的不那 么动态的( ...

  4. google 谷歌Python语言规范

    Python语言规范 https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_lan ...

  5. Python语言规范及风格规范

    语言规范: http://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_ ...

  6. Python语言规范

    Lint 对你的代码运行pylint 定义: pylint是一个在Python源代码中查找bug的工具. 对于C和C++这样的不那么动态的(译者注: 原文是less dynamic)语言, 这些bug ...

  7. 笔记——python语言规范

    Lint 对你的代码运行pylint 定义: pylint是一个在Python源代码中查找bug的工具. 对于C和C++这样的不那么动态的(译者注: 原文是less dynamic)语言, 这些bug ...

  8. python公司内部语言规范与语言风格

    一.python语言规范 1.1导入 Tip: 仅对包和模块使用导入 定义: 模块间共享代码的重用机制. 优点: 命名空间管理约定十分简单.每个标识符的源都用一种一致的方式指示.x.obj 表示obj ...

  9. Python开发规范

    背景 Python语言规范 Lint 导入 包 异常 全局变量 嵌套/局部/内部类或函数 列表推导(List Comprehensions) 默认迭代器和操作符 生成器 Lambda 函数 条件表达式 ...

随机推荐

  1. 『动善时』JMeter基础 — 14、使用JMeter发送Post请求

    目录 1.Post请求参数类型说明 2.用于演示的项目说明 3.发送Post请求示例 (1)测试计划内包含的元件 (2)请求参数类型为x-www-form-urlencoded 4.请求参数form- ...

  2. 名称空间 反向解析 reverse

  3. .Net Core·寄托于IIS的REST服务405的问题

    阅文时长 | 0.48分钟 字数统计 | 828.8字符 主要内容 | 1.引言&背景 2.声明与参考资料 『.Net Core·寄托于IIS的REST服务405的问题』 编写人 | SCsc ...

  4. [bug] SpringBoot 集成 jsp,访问时页面报Whitelabel Error Page

    参考 https://bbs.csdn.net/topics/392187702

  5. [笔记] 《c++ primer》书店程序 Chapter 1

    书店程序是<c++ primer>中重要的实例,涉及大部分重要知识点,但代码分散阅读不便,下面按照章节顺序总结 Sales_item.h #ifndef SALESITEM_H // we ...

  6. 其他CSS属性

    一.设置元素的颜色和透明度 a.color color 属性规定文本的颜色.这个属性设置了一个元素的前景色(在 HTML 表现中,就是元素文本的颜色):光栅图像不受 color 影响.这个颜色还会应用 ...

  7. Ansible触发器-tag标签-忽略错误

    触发器 playbook handlers handler`用来执行某些条件下的任务,比如当配置文件发生变化的时候,通过notify触发handler去重启服务. 在saltstack中也有类似的触发 ...

  8. android常用的四种对话框java代码

    AlterDialog:确认取消警告提示框 public void showAlertDialog(View view){ AlertDialog.Builder dialog = new Alert ...

  9. 使用Apache Pulsar + Hudi构建Lakehouse方案了解下?

    1. 动机 Lakehouse最早由Databricks公司提出,其可作为低成本.直接访问云存储并提供传统DBMS管系统性能和ACID事务.版本.审计.索引.缓存.查询优化的数据管理系统,Lakeho ...

  10. Your branch and 'origin/master' have diverged, and have 1 and 1 different commits each, respectively

    On branch master Your branch and 'origin/master' have diverged, and have 1 and 1 different commits e ...