当前位置:网站首页>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
边栏推荐
- Environment configuration
- Is the compass stock software reliable? Is it safe to trade stocks?
- LeetCode简单题分享(20)
- mysql ”Invalid use of null value“ 解决方法
- AutoCAD - how to input angle dimensions and CAD diameter symbols greater than 180 degrees?
- Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)
- Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
- THINKPHP框架的优秀开源系统推荐
- 566. Reshaping the matrix
- 2022-7-6 Leetcode 977. Square of ordered array
猜你喜欢

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

566. Reshaping the matrix

2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天

得物客服热线的演进之路

js 获取当前时间 年月日,uniapp定位 小程序打开地图选择地点

《厌女:日本的女性嫌恶》摘录

数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】

Redis 核心数据结构 & Redis 6 新特性详

Navicat run SQL file import data incomplete or import failed

. Net core about redis pipeline and transactions
随机推荐
FCOS3D label assignment
Flink | multi stream conversion
干货|总结那些漏洞工具的联动使用
Excuse me, when using Flink SQL sink data to Kafka, the execution is successful, but there is no number in Kafka
AutoCAD - how to input angle dimensions and CAD diameter symbols greater than 180 degrees?
648. 单词替换 : 字典树的经典运用
566. 重塑矩阵
Leetcode simple question sharing (20)
使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
Transferring files between VMware and host
IP and long integer interchange
Is it safe to open an account online now? Which securities company should I choose to open an account online?
Redis can only cache? Too out!
[high frequency interview questions] difficulty 2.5/5, simple combination of DFS trie template level application questions
内存溢出和内存泄漏的区别
postgresql array类型,每一项拼接
mysql ”Invalid use of null value“ 解决方法
Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)
2022-7-6 Leetcode 977.有序数组的平方
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array