From 41f4d5c3dc1ec7b067a8b0f23e27810c7bcbe25e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 27 Mar 2024 18:01:30 -0600 Subject: [PATCH] Add pre-commit, update flake8, run black --- .flake8 | 8 +++++++- .pre-commit-config.yaml | 8 ++++++++ gui/commands.py | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 index a6f727b..13aefa0 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,8 @@ [flake8] -ignore = E501, W503 +# 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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7afe60c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.3.0 + hooks: + - id: black + files: 'gdb/.*' diff --git a/gui/commands.py b/gui/commands.py index d600e97..6fd24db 100644 --- a/gui/commands.py +++ b/gui/commands.py @@ -228,7 +228,7 @@ class GuiDprintfCommand(GuiPrintBase): if not arg.startswith(","): raise gdb.GdbError("comma expected after linespec") arg = arg[1:] - spec = arg[0:-len(arg)] + spec = arg[0 : -len(arg)] gui.dprintf.DPrintfBreakpoint(spec, window, arg)