diff mbox series

[6/8] python: allow short names for variables on older pylint

Message ID 20240820002318.1380276-7-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show
Series move qapi under python/qemu/ | expand

Commit Message

John Snow Aug. 20, 2024, 12:23 a.m. UTC
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 mbox series

Patch

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.