Pylint变量名称不符合snake_case命名样式 [英] Pylint variable name doesn't conform to snake_case naming style

查看:115
本文介绍了Pylint变量名称不符合snake_case命名样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个来自pylint的警告,例如:'''变量名称"df"不符合snake_case命名样式'''据我了解,它的发生是因为变量名的长度少于3个符号.但是我想使用df,i,x等变量.

I have multiple warnings from pylint like that: '''Variable name "df" doesn't conform to snake_case naming style''' As I could understand, it happens because of variable name length less than 3 symbols. however I would like to use variables like df, i, x etc.

因此,我需要添加多个变量名称以减少异常.我试图将这些名称添加到我的项目目录中的manage.py所在的pylintrc文件的好名字部分中: pylintrc:'''#好的变量名,应始终接受,用逗号分隔.好名声= i,j,k,前任,跑步,df我l12l3'''它没有帮助,我仍然收到有关变量名样式的警告.如果有人可以提供想法,我将非常感激.

So, I require to add several variable names to linting exceptions. I tried to add that names to good-names section of pylintrc file in my project directory, where manage.py is located: pylintrc: '''# Good variable names which should always be accepted, separated by a comma. good-names=i, j, k, ex, Run, df, l, l1, l2, l3''' It didn't helped, I still received warnings about variable names style. I will highly appreciate if somebody could help with ideas.

推荐答案

.pylintrc 文件中, good-names = ... 行的开头应为 [BASIC] 关键字,即:

In the .pylintrc file, the good-names=... line should be prefaced by a [BASIC] keyword, i.e.:

[BASIC]

# Good variable names which should always be accepted, separated by a comma.
good-names=i, j, k, ex, Run, df, l, l1, l2, l3

这篇关于Pylint变量名称不符合snake_case命名样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆