- Oct 13, 2020
-
-
Laurent Vivier authored
.class_init is already set to serial_mm_class_init. Remove the duplicate entry. Fixes: 17fd1a64 ("serial-mm: add "regshift" property") Cc: marcandre.lureau@redhat.com Signed-off-by:
Laurent Vivier <lvivier@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com> Message-Id: <20201009113843.60995-1-lvivier@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Elena Afanasova authored
Spotted by PVS-Studio Signed-off-by:
Elena Afanasova <eafanasova@gmail.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <1e903f928eb3da332cc95e2a6f87243bd9fe66e4.camel@gmail.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Julia Suvorova authored
'occupied' is spelled like 'ocuppied' in the message. Signed-off-by:
Julia Suvorova <jusual@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201006133958.600932-1-jusual@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Philippe Mathieu-Daudé authored
Log invalid memory accesses with as GUEST_ERROR. This is particularly useful since commit 5d971f9e which reverted ("memory: accept mismatching sizes in memory_region_access_valid"). Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Message-Id: <20201005152725.2143444-1-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Greg Kurz authored
Signed-off-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Message-Id: <160165476743.57452.2128307974125615413.stgit@bahia.lan> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Christian Borntraeger authored
Fedora 32 gcc 10 seems to give false positives: Compiling C object libblock.fa.p/block_vmdk.c.o ../block/vmdk.c: In function ‘vmdk_parse_extents’: ../block/vmdk.c:587:5: error: ‘extent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 587 | g_free(extent->l1_table); | ^~~~~~~~~~~~~~~~~~~~~~~~ ../block/vmdk.c:754:17: note: ‘extent’ was declared here 754 | VmdkExtent *extent; | ^~~~~~ ../block/vmdk.c:620:11: error: ‘extent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 620 | ret = vmdk_init_tables(bs, extent, errp); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../block/vmdk.c:598:17: note: ‘extent’ was declared here 598 | VmdkExtent *extent; | ^~~~~~ ../block/vmdk.c:1178:39: error: ‘extent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1178 | extent->flat_start_offset = flat_offset << 9; | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ../block/vmdk.c: In function ‘vmdk_open_vmdk4’: ../block/vmdk.c:581:22: error: ‘extent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 581 | extent->l2_cache = | ~~~~~~~~~~~~~~~~~^ 582 | g_malloc(extent->entry_size * extent->l2_size * L2_CACHE_SIZE); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../block/vmdk.c:872:17: note: ‘extent’ was declared here 872 | VmdkExtent *extent; | ^~~~~~ ../block/vmdk.c: In function ‘vmdk_open’: ../block/vmdk.c:620:11: error: ‘extent’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 620 | ret = vmdk_init_tables(bs, extent, errp); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../block/vmdk.c:598:17: note: ‘extent’ was declared here 598 | VmdkExtent *extent; | ^~~~~~ cc1: all warnings being treated as errors make: *** [Makefile.ninja:884: libblock.fa.p/block_vmdk.c.o] Error 1 fix them by assigning a default value. Signed-off-by:
Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by:
Fam Zheng <fam@euphon.net> Message-Id: <20200930155859.303148-2-borntraeger@de.ibm.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Thomas Huth authored
For being able to compile with -Werror=implicit-fallthrough we need to use comments that the compiler recognizes. Use "fallthrough" instead of "no break" here. Signed-off-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201002171343.283426-1-thuth@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Philippe Mathieu-Daudé authored
As the 'timestamp' variable is declared as a 48-bit bitfield, we do not need to wrap the sum result. Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Klaus Jensen <k.jensen@samsung.com> Message-Id: <20201002075716.1657849-1-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Oct 12, 2020
-
-
Markus Armbruster authored
Missed in commit 41fba161 "docs/system: convert the documentation of deprecated features to rST." Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200929075824.1517969-3-armbru@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Markus Armbruster authored
Missed in 3c95fdef "Update comments in .hx files that mention Texinfo". Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200929075824.1517969-2-armbru@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Peter Maydell authored
QAPI patches patches for 2020-10-10 # gpg: Signature made Sat 10 Oct 2020 10:43:14 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2020-10-10: (34 commits) qapi/visit.py: add type hint annotations qapi/visit.py: remove unused parameters from gen_visit_object qapi/visit.py: assert tag_member contains a QAPISchemaEnumType qapi/types.py: remove one-letter variables qapi/types.py: add type hint annotations qapi/gen.py: delint with pylint qapi/gen.py: update write() to be more idiomatic qapi/gen.py: Remove unused parameter qapi/gen.py: add type hint annotations qapi/gen: Make _is_user_module() return bool qapi/source.py: delint with pylint qapi/source.py: add type hint annotations qapi/commands.py: add type hint annotations qapi/commands.py: Don't re-bind to variable of different type qapi/events.py: Move comments into docstrings qapi/events.py: add type hint annotations qapi: establish mypy type-checking baseline qapi/common.py: move build_params into gen.py qapi/common.py: Convert comments into docstrings, and elaborate qapi/common.py: add type hint annotations ... Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Oct 11, 2020
-
-
Peter Maydell authored
Testing, gitdm and plugin fixes: - fix acceptance regressions in MIPS and IDE - speed up cirrus msys2/mingw builds - add genisoimage to more docker images - slew of gitdb updates - fix some windows compile issues for plugins - add V=1 to cirrus output - disable rxsim in gitlab CI # gpg: Signature made Fri 09 Oct 2020 17:30:29 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-various-091020-1: (22 commits) tests/acceptance: disable machine_rx_gdbsim on GitLab cirrus: use V=1 when running tests on FreeBSD and macOS plugin: Fixes compiling errors on msys2/mingw plugins: Fixes a issue when dlsym failed, the handle not closed .mailmap: Fix more contributor entries contrib/gitdm: Add Yandex to the domain map contrib/gitdm: Add Yadro to the domain map contrib/gitdm: Add SUSE to the domain map contrib/gitdm: Add Nir Soffer to Red Hat domain contrib/gitdm: Add Qualcomm to the domain map contrib/gitdm: Add Nuvia to the domain map contrib/gitdm: Add Google to the domain map contrib/gitdm: Add ByteDance to the domain map contrib/gitdm: Add Baidu to the domain map contrib/gitdm: Add more individual contributors contrib/gitdm: Add more academic domains tests/docker: Add genisoimage to the docker file cirrus: msys2/mingw speed is up, add excluded target back cirrus: Fixing and speedup the msys2/mingw CI hw/ide: restore replay support of IDE ... Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Oct 10, 2020
-
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-37-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
And this fixes the pylint report for this file, so make sure we check this in the future, too. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201009161558.107041-36-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
This is true by design, but not presently able to be expressed in the type system. An assertion helps mypy understand our constraints. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-35-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
"John, if pylint told you to jump off a bridge, would you?" Hey, if it looked like fun, I might. Now that this file is clean, enable pylint checks on this file. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-34-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-33-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
'fp' and 'fd' are self-evident in context, add them to the list of OK names. _top and _bottom also need to stay standard methods because some users override the method and need to use `self`. Tell pylint to shush. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-32-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Make the file handling here just a tiny bit more idiomatic. (I realize this is heavily subjective.) Use exist_ok=True for os.makedirs and remove the exception, use fdopen() to wrap the file descriptor in a File-like object, and use a context manager for managing the file pointer. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20201009161558.107041-31-jsnow@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
_module_dirname doesn't use the 'what' argument, so remove it. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-30-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-28-jsnow@redhat.com> Message-Id: <20201009161558.107041-29-jsnow@redhat.com> [mypy.ini update squashed in] Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
_is_user_module() returns thruth values. The next commit wants it to return bool. Make it so. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201009161558.107041-27-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> [Commit message rewritten] Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Shush an error and leave a hint for future cleanups when we're allowed to use Python 3.7+. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-26-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. A note on typing of __init__: mypy requires init functions with no parameters to document a return type of None to be considered fully typed. In the case when there are input parameters, None may be omitted. Since __init__ may never return any value, it is preferred to omit the return annotation whenever possible. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-25-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-23-jsnow@redhat.com> Message-Id: <20201009161558.107041-24-jsnow@redhat.com> [mypy.ini update squashed in] Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Mypy isn't a fan of rebinding a variable with a new data type. It's easy enough to avoid. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20201009161558.107041-22-jsnow@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Clarify them while we're here. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-21-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. Note: __init__ does not need its return type annotated, as it is special. https://mypy.readthedocs.io/en/stable/class_basics.html#annotating-init-methods Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-20-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Fix a minor typing issue, and then establish a mypy type-checking baseline. Like pylint, this should be run from the folder above: > mypy --config-file=qapi/mypy.ini qapi/ This is designed and tested for mypy 0.770 or greater. Signed-off-by:
John Snow <jsnow@redhat.com> Tested-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-19-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Including it in common.py creates a circular import dependency; schema relies on common, but common.build_params requires a type annotation from schema. To type this properly, it needs to be moved outside the cycle. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-18-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
As docstrings, they'll show up in documentation and IDE help. The docstring style being targeted is the Sphinx documentation style. Sphinx uses an extension of ReST with "domains". We use the (implicit) Python domain, which supports a number of custom "info fields". Those info fields are documented here: https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists Primarily, we use `:param X: descr`, `:return[s]: descr`, and `:raise[s] Z: when`. Everything else is the Sphinx dialect of ReST. (No, nothing checks or enforces this style that I am aware of. Sphinx either chokes or succeeds, but does not enforce a standard of what is otherwise inside the docstring. Pycharm does highlight when your param fields are not aligned with the actual fields present. It does not highlight missing return or exception statements. There is no existing style guide I am aware of that covers a standard for a minimally acceptable docstring. I am debating writing one.) Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-17-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Annotations do not change runtime behavior. This commit *only* adds annotations. Note that build_params() cannot be fully annotated due to import dependency issues. The commit after next will take care of it. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-16-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Remove qapi/common.py from the pylintrc ignore list. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20201009161558.107041-15-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201009161558.107041-14-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
At this point, that just means using a consistent strategy for constant names. constants get UPPER_CASE and names not used externally get a leading underscore. As a preference, while renaming constants to be UPPERCASE, move them to the head of the file. Generally, it's nice to be able to audit the code that runs on import in one central place. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-13-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Code style tools really dislike the use of global keywords, because it generally involves re-binding the name at runtime which can have strange effects depending on when and how that global name is referenced in other modules. Make a little indent level manager instead. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-12-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-11-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Using `pylint --generate-rcfile > pylintrc`, generate a skeleton pylintrc file. Sections that are not presently relevant (by the end of this series) are removed leaving just the empty section as a search engine / documentation hint to future authors. I am targeting pylint 2.6.0. In the future (and hopefully before 5.2 is released), I aim to have gitlab CI running the specific targeted versions of pylint, mypy, flake8, etc in a job. 2.5.x will work if you additionally pass --disable=bad-whitespace. This warning was removed from 2.6.x, for lack of consistent support. Right now, quite a few modules are ignored as they are known to fail as of this commit. modules will be removed from the known-bad list throughout this and following series as they are repaired. Note: Normally, pylintrc would go in the folder above the module, but as that folder is shared by many things, it is going inside the module folder (for now). Due to a bug in pylint 2.5+, pylint does not correctly recognize when it is being run from "inside" a package, and must be run *outside* of the package. Therefore, to run it, you must: > pylint scripts/qapi/ --rcfile=scripts/qapi/pylintrc Signed-off-by:
John Snow <jsnow@redhat.com> Tested-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-10-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
Petty style guide fixes and line length enforcement. Not a big win, not a big loss, but flake8 passes 100% on the qapi module, which gives us an easy baseline to enforce hereafter. A note on the flake8 exception: flake8 will warn on *any* bare except, but pylint's is context-aware and will suppress the warning if you re-raise the exception. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Eduardo Habkost <ehabkost@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Message-Id: <20201009161558.107041-9-jsnow@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-
John Snow authored
While we're mucking around with imports, we might as well formalize the style we use. Let's use isort to do it for us. lines_after_imports=2: Use two lines after imports, to match PEP8's desire to have "two lines before and after" class definitions, which are likely to start immediately after imports. force_sort_within_sections: Intermingles "from x" and "import x" style statements, such that sorting is always performed strictly on the module name itself. force_grid_wrap=4: Four or more imports from a single module will force the one-per-line style that's more git-friendly. This will generally happen for 'typing' imports. multi_line_output=3: Uses the one-per-line indented style for long imports. include_trailing_comma: Adds a comma to the last import in a group, which makes git conflicts nicer to deal with, generally. line_length: 72 is chosen to match PEP8's "docstrings and comments" line length limit. If you have a single line import that exceeds 72 characters, your names are too long! Suggested-by:
Cleber Rosa <crosa@redhat.com> Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Cleber Rosa <crosa@redhat.com> Tested-by:
Cleber Rosa <crosa@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20201009161558.107041-8-jsnow@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com>
-