[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/8] python: allow short names for variables on older pylint
|
From: |
John Snow |
|
Subject: |
[PATCH 6/8] python: allow short names for variables on older pylint |
|
Date: |
Mon, 19 Aug 2024 20:23:15 -0400 |
Pylint >= 3.0.0 disabled this feature, but older pylint does not: allow
short names by default by using a regex to do so.
Incidentally, this removes the need for most of the allow list we had before, so
remove most of that, too.
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/setup.cfg | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/python/setup.cfg b/python/setup.cfg
index 72b58c98c99..58dba90f815 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -148,17 +148,11 @@ disable=consider-using-f-string,
[pylint.basic]
# Good variable names which should always be accepted, separated by a comma.
-good-names=i,
- j,
- k,
- ex,
- Run,
- _, # By convention: Unused variable
- fh, # fh = open(...)
- fd, # fd = os.open(...)
- c, # for c in string: ...
- T, # for TypeVars. See pylint#3401
- SocketAddrT, # Not sure why this is invalid.
+good-names=SocketAddrT, # Not sure why this is invalid.
+
+# pylint < 3.0 warns by default on short variable names.
+# Disable this for older versions.
+good-names-rgxs=^[_a-z][_a-z0-9]?$
[pylint.similarities]
# Ignore imports when computing similarities.
--
2.45.0
- [PATCH 0/8] move qapi under python/qemu/, John Snow, 2024/08/19
- [PATCH 1/8] python/qapi: correct re.Match type hints for 3.13, John Snow, 2024/08/19
- [PATCH 2/8] python/qapi: change "FIXME" to "TODO", John Snow, 2024/08/19
- [PATCH 5/8] python/qapi: ignore missing docstrings in pylint, John Snow, 2024/08/19
- [PATCH 3/8] python/qapi: add pylint pragmas, John Snow, 2024/08/19
- [PATCH 7/8] python/qapi: move scripts/qapi to python/qemu/qapi, John Snow, 2024/08/19
- [PATCH 8/8] python/qapi: remove redundant linter configuration, John Snow, 2024/08/19
- [PATCH 4/8] python/qapi: remove outdated pragmas, John Snow, 2024/08/19
- [PATCH 6/8] python: allow short names for variables on older pylint,
John Snow <=