23

In python i'm following camelCase Naming style. I checked my code with "pylint" and it gives error for not following lower_case_with_underscores style. Also i use netBeans IDE for coding. This IDE gives warning for not following lower_case_with_underscores style.

How to tell pylint and netBeans that i'm following camelCase naming style, not lower_case_with_underscores??

Thanks.

Ben James
  • 121,135
  • 26
  • 193
  • 155
Netro
  • 7,119
  • 6
  • 40
  • 58
  • 7
    Note that while that's perfectly valid under some circumstances, it's usually best to use the most common coding style in the language/framework/... if you don't have a compelling reason to do otherwise, even if it's not your personal preference. –  Mar 07 '11 at 14:23
  • Just don't use netBeans IDE and don't use camel case. – NeilG Apr 18 '23 at 00:49

4 Answers4

43

Use pylint --generate-rcfile > ~/.pylintrc to get a standard pylintrc.

Edit the file, go to the [BASIC] section, and change the following regexps:

  • function-rgx=_?_?[a-z][A-Za-z0-9]{1,30}$
  • method-rgx=_?_?[a-z][A-Za-z0-9]{1,30}$
  • attr-rgx=_?_?[a-z][A-Za-z0-9]{1,30}$
  • argument-rgx=_?[a-z][A-Za-z0-9]{1,30}$
  • variable-rgx=_?[a-z][A-Za-z0-9]{1,30}$
  • inlinevar-rgx=_?[a-z][A-Za-z0-9]{1,30}$

You may also want to change module-rgx while you are at it, and look around for other settings that you may want to customize to suite your style.

IanS
  • 15,771
  • 9
  • 60
  • 84
gurney alex
  • 13,247
  • 4
  • 43
  • 57
12

Accepted answer is outdated. Now its much simpler:

Use pylint --generate-rcfile > ~/.pylintrc to get a standard pylintrc.

Edit the file, go to the [BASIC] section, and change the different ...-naming-styles to camelCase.

Schneyer
  • 1,197
  • 1
  • 9
  • 27
2

for netbeans 8.0.2 ...

Tools --> Options --> Editor --> Hints --> Python --> Naming Conventions --> Functions --> mixedCase

mark
  • 21
  • 1
0

In VS-Code use this settings.json entry to have variable naming style and function naming style set to "camelCase",

    "pylint.args": [
      "--variable-naming-style=camelCase",
      "--function-naming-style=camelCase"
    ]

choose arguments as per your requirements, Pylint Documentation:

Akshay Chandran
  • 985
  • 11
  • 16