当前位置:网站首页>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
边栏推荐
- c#通过frame 和 page 切换页面
- [network security] SQL injection syntax summary
- TPG x AIDU | AI leading talent recruitment plan in progress!
- Data refresh of recyclerview
- What are the principles for distinguishing the security objectives and implementation methods that cloud computing security expansion requires to focus on?
- Excuse me, when using Flink SQL sink data to Kafka, the execution is successful, but there is no number in Kafka
- Excusez - moi, l'exécution a été réussie lors de l'utilisation des données de puits SQL Flink à Kafka, mais il n'y a pas de nombre dans Kafka
- Use day JS let time (displayed as minutes, hours, days, months, and so on)
- 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
- Parsing of XML files
猜你喜欢
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
LeetCode简单题分享(20)
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
Selenium库
566. 重塑矩阵
Leecode3. Longest substring without repeated characters
"New red flag Cup" desktop application creativity competition 2022
Vmware 与主机之间传输文件
Parsing of XML files
AI talent cultivation new ideas, this live broadcast has what you care about
随机推荐
The meaning of variables starting with underscores in PHP
Drawerlayout suppress sideslip display
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
干货|总结那些漏洞工具的联动使用
Realization of search box effect [daily question]
Navicat run SQL file import data incomplete or import failed
Flask session forged hctf admin
Redis can only cache? Too out!
Is it safe to open an account online now? Which securities company should I choose to open an account online?
接口自动化测试-接口间数据依赖问题解决
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
Excuse me, as shown in the figure, the python cloud function prompt uses the pymysql module. What's the matter?
交付效率提升52倍,运营效率提升10倍,看《金融云原生技术实践案例汇编》(附下载)
Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
Wired network IP address of VMware shared host
请问,如图,pyhon云函数提示使用了 pymysql模块,这个是怎么回事?
Es log error appreciation -limit of total fields
最佳实践 | 用腾讯云AI意愿核身为电话合规保驾护航
Take you to master the three-tier architecture (recommended Collection)
最长上升子序列模型 AcWing 482. 合唱队形