当前位置:网站首页>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
边栏推荐
- Thread pool reject policy best practices
- Help tenants
- Excellent open source system recommendation of ThinkPHP framework
- Is the spare money in your hand better to fry stocks or buy financial products?
- 3D Detection: 3D Box和点云 快速可视化
- Cesium 已知一点经纬度和距离求另一个点的经纬度
- Excuse me, why is it that there are no consumption messages in redis and they are all piled up in redis? Cerely is used.
- PHP中用下划线开头的变量含义
- requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
- Leetcode simple question sharing (20)
猜你喜欢

Build a secure and trusted computing platform based on Kunpeng's native security

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

2022-7-7 Leetcode 34.在排序数组中查找元素的第一个和最后一个位置

最长上升子序列模型 AcWing 1012. 友好城市

Help tenants

为租客提供帮助

"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?

Did login metamask

118. 杨辉三角

得物客服热线的演进之路
随机推荐
The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
3D Detection: 3D Box和点云 快速可视化
Cargo placement problem
Is the compass stock software reliable? Is it safe to trade stocks?
FC连接数据库,一定要使用自定义域名才能在外面访问吗?
搜索框效果的实现【每日一题】
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
[daily training] 648 Word replacement
.net core 关于redis的pipeline以及事务
Excuse me, when using Flink SQL sink data to Kafka, the execution is successful, but there is no number in Kafka
The difference between memory overflow and memory leak
2022-7-7 Leetcode 844. Compare strings with backspace
[AI practice] Application xgboost Xgbregressor builds air quality prediction model (II)
Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
Excuse me, as shown in the figure, the python cloud function prompt uses the pymysql module. What's the matter?
THINKPHP框架的优秀开源系统推荐
AutoCAD - how to input angle dimensions and CAD diameter symbols greater than 180 degrees?
Dry goods | summarize the linkage use of those vulnerability tools
最长上升子序列模型 AcWing 482. 合唱队形