gdb: disable formatting-related flake8 warnings

Message ID 20240223204309.416580-1-simon.marchi@polymtl.ca
State New
Headers
Series gdb: disable formatting-related flake8 warnings |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Simon Marchi Feb. 23, 2024, 8:43 p.m. UTC
  Tom Tromey pointed out that flake8 gives some warnings related to
formatting, such as:

    python/lib/gdb/prompt.py:149:43: E203 whitespace before ':'

We don't care about those, since all our formatting is handled
automatically by black, so ignore these warnings.

The list of warnings I put comes from:

  https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8

Note that since the setup.cfg file is under the gdb directory, it will
be picked up if you run flake8 from the gdb directory like this:

    binutils-gdb/gdb $ flake8 python

but not if you do:

    binutils-gdb $ flake8 gdb/python

Change-Id: I1e42aefd388b9c3b6c9d52b4f635ac881db4bbc1
---
 gdb/setup.cfg | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 gdb/setup.cfg


base-commit: bf8ab2ae8d33e46bb6612408c75e75a6de137ccc
  

Comments

Tom Tromey Feb. 23, 2024, 9:07 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> +# E203: Whitespace before ':' (conclicts with black's way of formatting)

"conflicts"

Ok with that fixed IMO.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  
Simon Marchi Feb. 23, 2024, 10 p.m. UTC | #2
On 2024-02-23 16:07, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
> 
> Simon> +# E203: Whitespace before ':' (conclicts with black's way of formatting)
> 
> "conflicts"

Ah, oops, this typo actually comes from where I copied the line (another
project I work on):

https://github.com/efficios/babeltrace/blob/5ecc1dc9a8d3ba726539fdd67e1be6a99f7dacf2/setup.cfg#L5

I changed the comment so it makes more sense, remove an extra "E701" as
well:

[flake8]
# Disable some formatted-related warnings that conflict with black's way of
# formatting code.
#
# E203: Whitespace before ':'
# E501: line too long
# E701: Multiple statements on one line (colon)
ignore = E203,E501,E701

I pushed that version.

Thanks,

Simon
  

Patch

diff --git a/gdb/setup.cfg b/gdb/setup.cfg
new file mode 100644
index 000000000000..28d7c876b33c
--- /dev/null
+++ b/gdb/setup.cfg
@@ -0,0 +1,5 @@ 
+[flake8]
+# E203: Whitespace before ':' (conclicts with black's way of formatting)
+# E501: line too long
+# E701: Multiple statements on one line (colon) (E701)
+ignore = E203,E501,E701