当前位置:网站首页>VSCode 配置使用 PyLint 语法检查器
VSCode 配置使用 PyLint 语法检查器
2022-07-07 12:11:00 【jiang_huixin】
- 首先安装 “Python” 插件
- 安装
pylint
语法检查器
推荐安装在当前的 Python 环境中
pip3 install pylint
- 启用
pylint
语法检查器
打开 VSCode 的配置文件
添加以下内容:
{
// 代码检查
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
// 保存 Python 文件时检查语法
"python.linting.lintOnSave": true
}
- 配置
pylint
语法检查器
创建 .pylintrc 文件
pylint --generate-rcfile > .pylintrc
其中 pylint 位于 Python 环境(在该环境中安装的 pylint)中的 bin 目录, 运行以上命令可能要指定 pylint 的绝对路径
然后将生成的 .pylintrc 文件移至项目的根目录下
在 VSCode 配置中添加配置:
{
// 指定 .pylintrc 的路径, ${workspaceFolder} 表示当前项目的根目录
"python.linting.pylintArgs": [
"--rcfile=${workspaceFolder}/.pylintrc"
]
}
如果 pylint 没有安装在 VSCode 当前的 Python 环境, 则需要添加以下配置(需修改 pylint 的实际路径)
{
// 指定 pylint 的路径
"python.linting.pylintPath": "${env:HOME}/Miniconda/bin/pylint"
}
- 禁用某些检查项
pylint 存在过度检查的情况, 以下是没有写模块文档字符串的提示:
有 3 种级别的方法禁用这样的提示:
- 代码处添加注释
# pylint: disable=missing-module-docstring
- 修改 pylint 的运行参数
修改 VSCode 的配置
以下展示了如何禁用 invalid-name 和 missing-module-docstring 两种检查项:
{
"python.linting.pylintArgs": [
"--rcfile=${workspaceFolder}/.pylintrc",
"--disable=invalid-name,missing-module-docstring"
]
}
- 修改 .pylintrc 文件
在 .pylintrc 文件中搜索 “diable”, 在末尾添加一项 “missing-module-docstring”
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
not-callable,
missing-module-docstring
边栏推荐
- 社会责任·价值共创,中关村网络安全与信息化产业联盟对话网信企业家海泰方圆董事长姜海舟先生
- 请问指南针股票软件可靠吗?交易股票安全吗?
- Is it safe to open an account online now? Which securities company should I choose to open an account online?
- docker部署oracle
- 【日常训练--腾讯精选50】231. 2 的幂
- How does MySQL control the number of replace?
- Interface automation test - solution of data dependency between interfaces
- Move base parameter analysis and experience summary
- 2022-7-6 Leetcode 977. Square of ordered array
- 2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
猜你喜欢
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
2022-7-6 Leetcode27. Remove the element - I haven't done the problem for a long time. It's such an embarrassing day for double pointers
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
XML文件的解析操作
高等數學---第八章多元函數微分學1
566. 重塑矩阵
2022-7-6 beginner redis (I) download, install and run redis under Linux
Help tenants
How to check the ram and ROM usage of MCU through Keil
室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
随机推荐
Vmware 与主机之间传输文件
566. 重塑矩阵
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Help tenants
IP and long integer interchange
Attribute keywords aliases, calculated, cardinality, ClientName
Realization of search box effect [daily question]
Details of redis core data structure & new features of redis 6
Excuse me, I have three partitions in Kafka, and the flinksql task has written the join operation. How can I give the join operation alone
FCOS3D label assignment
PHP中用下划线开头的变量含义
The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)
TPG x AIDU | AI leading talent recruitment plan in progress!
得物客服热线的演进之路
Common response status codes
2022-7-7 Leetcode 34.在排序数组中查找元素的第一个和最后一个位置
3D Detection: 3D Box和点云 快速可视化
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
MySQL error 28 and solution
Learning breakout 2 - about effective learning methods