[PATCH 02/16] build-aux: skip E203 and W503 flake8 checks

Daniel P. Berrangé berrange at redhat.com
Wed Mar 8 16:38:59 UTC 2023


The flake8 check W503 does not want a line break before
binary operator. This is contrary to the style that the
'black' formatting tool wants to use. Defer to 'black'
as it is intended to be an opinionated formatting tool
standardizing python code style, and thus not to be
customized per project.

The flake8 check E203 does not want whitespace before
a ':'. This is, however, desirable when indexing array
slices eg

   self.lookahead[skip : skip + 1]

which is a format that 'black' produces.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 build-aux/syntax-check.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 21f6b311ce..158f14e77e 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -568,15 +568,22 @@ sc_prohibit_python_without_env:
 
 # We're intentionally ignoring a few warnings
 #
+# E302: whitespace before ':'. This is something that is
+# desirable when indexing array slices and is used by the
+# 'black' formatting tool
+#
 # E501: Force breaking lines at < 80 characters results in
 # some really unnatural code formatting which harms
 # readability.
 #
+# W503: line break before binary operator, because this
+# is contrary to what 'black' formatting tool wants
+#
 # W504: Knuth code style requires the operators "or" and "and" etc
 # to be at the start of line in a multi-line conditional.
 # This the opposite to what is normal libvirt practice.
 #
-FLAKE8_IGNORE = E501,W504
+FLAKE8_IGNORE = E203,E501,W503,W504
 
 sc_flake8:
 	@if [ -n "$(FLAKE8)" ]; then \
-- 
2.39.1



More information about the libvir-list mailing list