summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Snow2022-02-11 19:36:50 +0100
committerMarkus Armbruster2022-02-28 11:39:35 +0100
commit90254ec46dbf9c844f913a23c88ee24fb969c49b (patch)
tree32047cb199edd993842311351a1b342ffbd289c7
parentMerge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' ... (diff)
downloadqemu-90254ec46dbf9c844f913a23c88ee24fb969c49b.tar.gz
qemu-90254ec46dbf9c844f913a23c88ee24fb969c49b.tar.xz
qemu-90254ec46dbf9c844f913a23c88ee24fb969c49b.zip
scripts/qapi: minor delinting
Get isort and pylint tools passing again. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20220211183650.2946895-1-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Comment explaining good-names-rgxs tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r--scripts/qapi/commands.py2
-rw-r--r--scripts/qapi/pylintrc16
-rw-r--r--scripts/qapi/types.py6
-rw-r--r--scripts/qapi/visit.py6
4 files changed, 17 insertions, 13 deletions
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 869d799ed2..38ca38a7b9 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -25,8 +25,8 @@ from .gen import (
QAPIGenC,
QAPISchemaModularCVisitor,
build_params,
- ifcontext,
gen_special_features,
+ ifcontext,
)
from .schema import (
QAPISchema,
diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
index b259531a72..a724628203 100644
--- a/scripts/qapi/pylintrc
+++ b/scripts/qapi/pylintrc
@@ -34,16 +34,12 @@ disable=fixme,
[BASIC]
-# Good variable names which should always be accepted, separated by a comma.
-good-names=i,
- j,
- k,
- ex,
- Run,
- _,
- fp, # fp = open(...)
- fd, # fd = os.open(...)
- ch,
+# Good variable names regexes, separated by a comma. If names match any regex,
+# they will always be accepted.
+#
+# Suppress complaints about short names. PEP-8 is cool with them,
+# and so are we.
+good-names-rgxs=^[_a-z][_a-z0-9]?$
[VARIABLES]
diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
index 3013329c24..477d027001 100644
--- a/scripts/qapi/types.py
+++ b/scripts/qapi/types.py
@@ -16,7 +16,11 @@ This work is licensed under the terms of the GNU GPL, version 2.
from typing import List, Optional
from .common import c_enum_const, c_name, mcgen
-from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext
+from .gen import (
+ QAPISchemaModularCVisitor,
+ gen_special_features,
+ ifcontext,
+)
from .schema import (
QAPISchema,
QAPISchemaEnumMember,
diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py
index e13bbe4292..380fa197f5 100644
--- a/scripts/qapi/visit.py
+++ b/scripts/qapi/visit.py
@@ -21,7 +21,11 @@ from .common import (
indent,
mcgen,
)
-from .gen import QAPISchemaModularCVisitor, gen_special_features, ifcontext
+from .gen import (
+ QAPISchemaModularCVisitor,
+ gen_special_features,
+ ifcontext,
+)
from .schema import (
QAPISchema,
QAPISchemaEnumMember,
an class='column1'>| | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a long time, we assumed that libxml2 is necessary for parallels block format support (block/parallels*). However, this format actually does not use libxml [*]. Since this is the only user of libxml2 in whole QEMU tree, we can drop all libxml2 checks and dependencies too. It is even more: --enable-parallels configure option was the only option which was silently ignored when it's (fake) dependency (libxml2) isn't installed. Drop all mentions of libxml2. [*] Actually the basis for libxml use were introduced in commit ed279a06c53 ("configure: add dependency") but the implementation was never merged: https://lore.kernel.org/qemu-devel/70227bbd-a517-70e9-714f-e6e0ec431be9@openvz.org/ Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220119090423.149315-1-mjt@msgid.tls.msk.ru> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [PMD: Updated description and adapted to use lcitool] Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220121154134.315047-5-f4bug@amsat.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20220204204335.1689602-9-alex.bennee@linaro.org> * checkpatch: Do not allow deprecated g_memdup()Philippe Mathieu-Daudé2021-12-171-0/+5 | | | | | | | | | | | | | g_memdup() is insecure and as been deprecated in GLib 2.68. QEMU provides the safely equivalent g_memdup2() wrapper. Do not allow more g_memdup() calls in the repository, provide a hint to use g_memdup2(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210903174510.751630-29-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu> * scripts/checkpatch: roll diff tweaking into checkpatch itselfAlex Bennée2021-06-251-1/+6 | | | | | | | | | | | | | | Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20210623102749.25686-4-alex.bennee@linaro.org> * scripts/checkpatch.pl: process .c.inc and .h.inc files as C sourceMatheus Ferst2021-06-071-2/+2 | | | | | | | | | | Change the regex used to determine whether a file should be processed as C source to include .c.inc and .h.inc extensions. Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> Reviewed-by: Luis Pires <luis.pires@eldorado.org.br> Message-Id: <20210520195142.941261-1-matheus.ferst@eldorado.org.br> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> * checkpatch: Fix use of uninitialized valueGreg Kurz2021-05-141-0/+1 | | | | | | | | | | | | | | | | checkfilename() doesn't always set $acpi_testexpected. Fix the following warning: Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529. Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files") Cc: isaku.yamahata@intel.com Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <161786467973.295167.5612704777283969903.stgit@bahia.lan> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * checkpatch: don't emit warning on newly created acpi data filesIsaku Yamahata2021-02-231-1/+3 | | | | | | | | | | | | Newly created acpi data files(tests/data/acpi/) cause false positive warning. If file names are acpi expected file, don't emit warning. Fixes: e625ba2a41 ("checkpatch: fix acpi check with multiple file name") Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> Message-Id: <6899f9ad54cab8e7deca94ff0eeab641680e2b5e.1613615732.git.isaku.yamahata@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * scripts/checkpatch: Improve the check for authors mangled by the mailing listThomas Huth2021-02-191-1/+1 | | | | | | | | | | | | | | | | | There were recently some patches on the list which had their "From:" line mangled like this: From: qemu_oss--- via <qemu-devel@nongnu.org> Since our test in the checkpatch.pl script did not trigger here, the patches finally also ended up in a pull request, with the wrong author set. So let's improve the regular expression to also complain on these new patterns, too. Message-Id: <20210216071512.1199827-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Thomas Huth <thuth@redhat.com> * scripts/checkpatch.pl: fix git-show invocation to include diffstatAlex Bennée2021-01-181-1/+1 | | | | | | | | | | | | Without this checkpatch keeps complaining about new/changed files even when MAINTAINERS has been updated. Normal invocations of checkpatch on patch files rather than commit IDs are unaffected. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210114165730.31607-13-alex.bennee@linaro.org> * scripts: fix error from checkpatch.pl when no commits are foundDaniel P. Berrangé2020-10-271-1/+1 | | | | | | | | | | The error message was supposed to mention the input revision list start point, not the branch flag. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20201019143537.283094-3-berrange@redhat.com> Message-Id: <20201021163136.27324-6-alex.bennee@linaro.org> * checkpatch: Detect '%#' or '%0#' in printf-style format stringsDov Murik2020-09-301-2/+8 | | | | | | | | | | | | | | | | | | | | | | | | | | According to the coding style document, we should use literal '0x' prefix instead of printf's '#' flag (which appears as '%#' or '%0#' in the format string). Add a checkpatch rule to enforce that. Note that checkpatch already had a similar rule for trace-events files. Example usage: $ scripts/checkpatch.pl --file chardev/baum.c ... ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #366: FILE: chardev/baum.c:366: + DPRINTF("Broken packet %#2x, tossing\n", req); \ ... ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #472: FILE: chardev/baum.c:472: + DPRINTF("unrecognized request %0#2x\n", req); ... Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com> Message-Id: <20200914172623.72955-1-dovmurik@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> * checkpatch: avoid error on cover letter filesStefano Garzarella2020-09-301-1/+1 | | | | | | | | | | | | | | | | | | | | Running checkpatch on a directory that contains a cover letter reports this error: Checking /tmp/tmpbnngauy3/0000-cover-letter.patch... ERROR: Does not appear to be a unified-diff format patch total: 1 errors, 0 warnings, 0 lines checked Let's skip cover letter as it is already done in the Linux kernel commits 06330fc40e3f ("checkpatch: avoid NOT_UNIFIED_DIFF errors on cover-letter.patch files") and a08ffbef4ab7 ("checkpatch: fix ignoring cover-letter logic"). Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200917170212.92672-1-sgarzare@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> * scripts/texi2pod: Delete unused scriptPeter Maydell2020-09-291-1/+1 | | | | | | | | | | | We no longer need the texi2pod script, so we can delete it, and the special-casing it had in the checkpatch script. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-19-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> * scripts/: fix some comment spelling errorszhaolichang2020-09-171-1/+1 | | | | | | | | | | | I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the scripts folder. Signed-off-by: zhaolichang <zhaolichang@huawei.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200917075029.313-5-zhaolichang@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu> * checkpatch: Change occurences of 'kernel' to 'qemu' in user messagesAleksandar Markovic2020-07-111-3/+3 | | | | | | | | | | | | It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root. Replace that and few other similar odd user messages. Signed-off-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> Message-Id: <20200620133207.26849-3-aleksandar.qemu.devel@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> * checkpatch: reversed logic with acpi test checksMichael S. Tsirkin2020-06-121-1/+1 | | | | | | | | | | | | | Logic reversed: allowed list should just be ignored. Instead we only take that into account :( Fixes: e11b06a880ca ("checkpatch: ignore allowed diff list") Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20200602053614.54745-1-mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> * checkpatch: ignore allowed diff listMichael S. Tsirkin2020-05-041-5/+6 | | | | | | | | | | Allow changing allowed diff list at any point: - when changing code under test - when adding expected files It's just a list of files so easy to review and merge anyway. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * checkpatch: fix acpi check with multiple file nameMichael S. Tsirkin2020-05-04