From 874162eb9fc8c067ebbaa1e56fad5d6ca5c93e63 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 5 Dec 2024 12:41:21 -0500 Subject: pre-commit: run flake8 on more Python files pre-commit currently runs flake8 only on `gdb/python/**/*.py`. There are more files we can run it on, without running it on all the testsuite files. Add: - gdb/gdb-gdb.py.in - gdb/*.py - gdb/testsuite/*.py Fix the new errors that popped up: gdb/copyright.py:29:21: W605 invalid escape sequence '\*' gdb/copyright.py:29:29: W605 invalid escape sequence '\*' gdb/copyright.py:29:38: W605 invalid escape sequence '\*' gdb/copyright.py:29:46: W605 invalid escape sequence '\*' gdb/copyright.py:34:1: F401 'datetime' imported but unused gdb/testsuite/analyze-racy-logs.py:150:9: E722 do not use bare 'except' Change-Id: Ia864c22d4f170d4e18ce3beb06a86c49966654b2 Approved-By: Tom Tromey --- gdb/copyright.py | 25 ++++++++++++------------- gdb/testsuite/analyze-racy-logs.py | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'gdb') diff --git a/gdb/copyright.py b/gdb/copyright.py index 2c9ea3c..1a155b9 100755 --- a/gdb/copyright.py +++ b/gdb/copyright.py @@ -17,21 +17,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""copyright.py - -This script updates the list of years in the copyright notices in -most files maintained by the GDB project. - -Usage: cd src/gdb && ./copyright.py - -Always review the output of this script before committing it! -A useful command to review the output is: - % filterdiff -x \*.c -x \*.cc -x \*.h -x \*.exp updates.diff -This removes the bulk of the changes which are most likely to be correct. -""" +# This script updates the list of years in the copyright notices in +# most files maintained by the GDB project. +# +# Usage: cd src/gdb && ./copyright.py +# +# Always review the output of this script before committing it! +# +# A useful command to review the output is: +# +# $ filterdiff -x \*.c -x \*.cc -x \*.h -x \*.exp updates.diff +# +# This removes the bulk of the changes which are most likely to be correct. import argparse -import datetime import locale import os import os.path diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py index 5a3f90e..3863bd0 100755 --- a/gdb/testsuite/analyze-racy-logs.py +++ b/gdb/testsuite/analyze-racy-logs.py @@ -147,7 +147,7 @@ def identify_racy_tests(): for s1, s2 in ignore_relations.items(): try: ignored_tests |= all_tests[s1] & all_tests[s2] - except: + except Exception: continue racy_tests: set[str] = set() -- cgit v1.1