I have a private variable in a class - _expected_substring_result
.
This is the line 26 in my module, which is part of my init function - self._expected_substring_result = _expected_substring_result
.
This is the error I'm getting from lint-python -
..\endpoint.py:26:4: C0103: Attribute name "_expected_substring_result" doesn't conform to '[a-z_][a-z0-9_]{0,30}$' pattern (invalid-name)
.
This doesn't make sense - a private field in python is supposed to begin with an underscore.
I know how to fix it, by either editing the linter config, or adding # pylint: disable=invalid-name
. But this seems too odd an issue to just be something the pylint devs forgot about.
Is this a bug, or am I missing something ?
Thanks,
You can give to pylint the format you use for attribute names with the --attr-rgx
option. For example to have attribute starting with possibly two underscores:
pylint --attr-rgx=_?_?[a-z0-9]+(_[a-z]+)*_?_?$ ...
Several such naming schemes can be defined: for class names, for module names, ...
You can also edit your pylintrc
file to change this parameter.