From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"John Snow" <jsnow@redhat.com>
Subject: [PATCH v4 2/4] [DO-NOT-MERGE]: Add some ad-hoc linting helpers.
Date: Fri, 3 Feb 2023 13:47:31 -0500 [thread overview]
Message-ID: <20230203184733.523522-3-jsnow@redhat.com> (raw)
In-Reply-To: <20230203184733.523522-1-jsnow@redhat.com>
These aren't ready for upstream inclusion, because they do not properly
manage version dependencies, execution environment and so on. These are
just the tools I use in my Own Special Environment :tm: for testing and
debugging.
They've been tested only on Fedora 37 for right now, which means:
Python 3.11.1
pylint 2.14.4-3.fc37
mypy 0.982-1.fc37
isort 5.10.1-5.fc37
flake8 5.0.3-1.fc37
The python packaging work does a more exhaustive treatment and
exploration of minimum (and maximum) package requirements; the hope is
that eventually these two series will converge and these dependencies
will all be handled by configuration in qemu.git/python/.
For now, this is just a baseline under one environment to give us some
guidance.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi-lint.sh | 29 +++++++++++++++++++++++++++++
scripts/qapi/Makefile | 5 +++++
2 files changed, 34 insertions(+)
create mode 100755 scripts/qapi-lint.sh
create mode 100644 scripts/qapi/Makefile
diff --git a/scripts/qapi-lint.sh b/scripts/qapi-lint.sh
new file mode 100755
index 00000000000..2c2f2808ca6
--- /dev/null
+++ b/scripts/qapi-lint.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -e
+
+if [[ -f qapi/.flake8 ]]; then
+ echo "flake8 --config=qapi/.flake8 qapi/"
+ flake8 --config=qapi/.flake8 qapi/
+fi
+if [[ -f qapi/pylintrc ]]; then
+ echo "pylint --rcfile=qapi/pylintrc qapi/"
+ pylint --rcfile=qapi/pylintrc qapi/
+fi
+if [[ -f qapi/mypy.ini ]]; then
+ echo "mypy --config-file=qapi/mypy.ini qapi/"
+ mypy --config-file=qapi/mypy.ini qapi/
+fi
+
+if [[ -f qapi/.isort.cfg ]]; then
+ pushd qapi
+ echo "isort -c ."
+ isort -c .
+ popd
+fi
+
+pushd ../bin/git
+make -j9
+make check-qapi-schema
+make docs
+make sphinxdocs
+popd
diff --git a/scripts/qapi/Makefile b/scripts/qapi/Makefile
new file mode 100644
index 00000000000..314e8a5505e
--- /dev/null
+++ b/scripts/qapi/Makefile
@@ -0,0 +1,5 @@
+check:
+ isort -c .
+ flake8 .
+ cd .. && pylint --rcfile=qapi/pylintrc qapi
+ cd .. && mypy -p qapi --config-file=qapi/mypy.ini
--
2.39.0
next prev parent reply other threads:[~2023-02-03 18:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 18:47 [PATCH v4 0/4] [DO-NOT-MERGE] qapi: static typing conversion, "pt0" John Snow
2023-02-03 18:47 ` [PATCH v4 1/4] [DO-NOT-MERGE] docs: enable sphinx-autodoc for scripts/qapi John Snow
2023-02-03 18:47 ` John Snow [this message]
2023-02-03 18:47 ` [PATCH v4 3/4] qapi: Update flake8 config John Snow
2023-02-04 11:24 ` Markus Armbruster
2023-02-03 18:47 ` [PATCH v4 4/4] qapi: update pylint configuration John Snow
2023-02-04 11:34 ` Markus Armbruster
2023-02-06 15:59 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230203184733.523522-3-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.