Pylint- Pylintrc文档在哪里?

发布于 2025-02-13 17:25:00 字数 429 浏览 0 评论 0原文

运行Pylint

指定适合您的设置和编码标准的所有选项可能很乏味,因此可以使用配置文件指定默认值。您可以使用-rcfile选项在命令行上指定配置文件。否则,Pylint按以下顺序搜索配置文件,并使用它所找到的第一个文件:

放置MAX-LINE-LENGTH,但抱怨没有部分。如何格式化PylIntrc文件的文档在哪里?

〜/.pylintrc

max-line-length=120

Running Pylint

Specifying all the options suitable for your setup and coding standards can be tedious, so it is possible to use a configuration file to specify the default values. You can specify a configuration file on the command line using the --rcfile option. Otherwise, Pylint searches for a configuration file in the following order and uses the first one it finds:

Place the max-line-length but it complains there is no section. Where is the documentation of how to format the pylintrc file?

~/.pylintrc

max-line-length=120

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别再吹冷风 2025-02-20 17:25:01

因此,似乎没有专门用于制作.pylintrc文件的文档。但是,通过对文档和我自己的故障排除的一些交叉引用,我认为我理解了这种格式。

您需要查看 Checkers 页面。配置选项将分为几节,例如主要的检查器,基本检查器等。要在.pyntrc文件中设置一个选项,它必须在与Checker类型相对应的部分标题下。然后在没有领先连字符的情况下输入选项。

以下是我创建的最小.pylintrc文件的示例。选项disableExtension-pkg-allow-listsource-roots在主检查程序下[MAIN]。选项const-namingStyle在基本检查器下,因此我将其放在标题[basic]的部分中。

[MAIN]
disable=too-many-locals
extension-pkg-allow-list=lxml
source-roots=.

[BASIC]
const-naming-style=snake_case

这就是我发现有效的东西。最坏的情况,您将必须使用Pylint-generate-rcfile生成默认配置文件,然后从那里弄清楚它。

So it appears there is no documentation specifically for making .pylintrc files. But through some cross referencing of the documentation and my own troubleshooting, I think I understand the format.

You need to look at the Checkers page. The config options will be grouped into sections such as Main checkers, Basic checkers, etc. To set an option in a .pylintrc file, it must be under a section header corresponding to the type of checker. Then enter the option without the leading hyphens.

Below is an example of a minimal .pylintrc file I created. The options disable, extension-pkg-allow-list, and source-roots were under Main Checker so I put them in the section with header [MAIN]. The option const-namingstyle is under Basic Checker so I put it in the section with header [BASIC].

[MAIN]
disable=too-many-locals
extension-pkg-allow-list=lxml
source-roots=.

[BASIC]
const-naming-style=snake_case

This is what I found works. Worst case, you will have to generate a default config file with pylint --generate-rcfile and figure it out from there.

∞觅青森が 2025-02-20 17:25:00

请使用不需要部分的最新版本的Pylint。配置文档为

这里href =“ https://pylint.pycqa.org/en/latest/faq.html?highlight = genereser%20configuration#how-do-i-i-find-the-name-name-corresport-the-name-corresporting to-a to-a to-a to to to to to a to a a -option“ rel =” nofollow noreferrer”>自动生成配置文件:

pylint --generate-toml-config

在实践中,它通常是最好创建最小配置文件,该文件仅包含配置覆盖。对于所有其他选项,Pylint将使用其默认值。

Please use the latest version of pylint where no sections are required. The configuration documentation is here

You can generate a configuration file automatically:

pylint --generate-toml-config

In practice, it is often better to create a minimal configuration file which only contains configuration overrides. For all other options, Pylint will use its default values.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文