22

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.

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.

Alexander
  • 391
  • 1
  • 3
  • 10
  • Run from there with `pylint --rcfile=.pylintrc`. Probably it is not using your configuration file. Use whatever name your config file has. It looks you named yours pylintrc only (without dot) – progmatico Oct 31 '20 at 15:07
  • 1
    I still can't understand, why my configuration file is not used... I renamed it to .pylintrc and run in terminal `pylint --rcfile=.pylintrc`. Nothing happened, terminal returned just a list of options. From documentation I see: Pylint searches for a configuration file in the following order and uses the first one it finds: 1. pylintrc in the current working directory 2. .pylintrc in the current working directory – Alexander Oct 31 '20 at 17:15

1 Answers1

25

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
fpavogt
  • 411
  • 5
  • 11
  • 4
    And in VS Code: `"python.linting.pylintArgs": ["--good-names=x,y,z,i,j,n,f"],`. For what it's worth, `df` usually isn't a good variable name. It just tells that it probably is a pandas dataframe, but it doesn't tell at all what it contains. – Eric Duminil Mar 16 '23 at 21:05