Is there a way to configure the checks for the bad-whitespace
checks in PyLint? I can currently disable checking but I would much rather enforce a whitespace convention instead of disabling it.
PyLint bad-whitespace Configuration
There are two options you could use:
Globally disable the bad-whitespace warning:
pylint --disable=C0326
Use a Pylint configuration file:
pylint --rcfile=/path/to/config.file
This is what you would put in the config file to disable the bad-whitespace warning:
disable=C0326
The .pylintrc file does offer limited editing of whitespace rules, using the attribute no-space-check
:
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=
Might be more options in the near-future, though.
Pylint 2.6: The no-space-check option has been removed, it's no longer possible to consider empty line like a trailing-whitespace by using clever options pylint.pycqa.org/en/latest/whatsnew/2.6.html . –
Watson
The ID of bad-whitespace
convention check is C0326
from pylint 1.1.0 onwards. You can use this code in the .pylintrc config file to enable/disable the bad-whitespace
check.
[MESSAGES CONTROL]
enable=C0326
or
[MESSAGES CONTROL]
disable=C0326
© 2022 - 2024 — McMap. All rights reserved.