← 返回命令列表

Linux command

pylint 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Check Python file

pylint [file.py]

Check with specific config

pylint --rcfile=[.pylintrc] [file.py]

Disable specific warnings

pylint --disable=[C0114] [file.py]

Generate config file

pylint --generate-rcfile > [.pylintrc]

Output as JSON

pylint --output-format=json [file.py]

说明

pylint is a comprehensive static analysis tool that checks Python code for programming errors, coding standard violations, and code smells. It inspects modules without running them, reporting issues organized by category: conventions (C), refactoring suggestions (R), warnings (W), errors (E), and fatal problems (F), each with a numeric code for precise filtering. The tool is highly configurable through .pylintrc files or pyproject.toml sections, allowing teams to enable, disable, or customize individual checks to match project standards. It also produces an overall code quality score out of 10, making it useful for tracking code health over time in CI pipelines. Plugins extend its analysis to frameworks like Django and SQLAlchemy.

参数

--rcfile _FILE_
Configuration file.
--disable _IDS_
Disable checks.
--enable _IDS_
Enable checks.
--output-format _FORMAT_
Output format.
--generate-rcfile
Generate config.

FAQ

What is the pylint command used for?

pylint is a comprehensive static analysis tool that checks Python code for programming errors, coding standard violations, and code smells. It inspects modules without running them, reporting issues organized by category: conventions (C), refactoring suggestions (R), warnings (W), errors (E), and fatal problems (F), each with a numeric code for precise filtering. The tool is highly configurable through .pylintrc files or pyproject.toml sections, allowing teams to enable, disable, or customize individual checks to match project standards. It also produces an overall code quality score out of 10, making it useful for tracking code health over time in CI pipelines. Plugins extend its analysis to frameworks like Django and SQLAlchemy.

How do I run a basic pylint example?

Run `pylint [file.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --rcfile _FILE_ do in pylint?

Configuration file.