Add pre-commit, update flake8, run black

This commit is contained in:
Tom Tromey
2024-03-27 18:01:30 -06:00
parent f2bbafeedb
commit 41f4d5c3dc
3 changed files with 16 additions and 2 deletions

View File

@@ -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

8
.pre-commit-config.yaml Normal file
View File

@@ -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/.*'

View File

@@ -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)