From patchwork Thu Dec 5 17:41:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 102492 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 26DB63858C41 for ; Thu, 5 Dec 2024 17:42:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26DB63858C41 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=Rlv9QmgD; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=cNZMECr2 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id AFCBF3858D20 for ; Thu, 5 Dec 2024 17:41:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFCBF3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AFCBF3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733420489; cv=none; b=bc6HmMwkZlas/KrhrlkxNHqRlvYk8gOtLMT/HgBkBVdOtjdSLx4j0pWBo059R8n6UptQsWCB+z2gR03UgT0Agu9Z0cH+iT9imBnmOc3AMVkESygF6hxrdVniQYHBZMgKykNTawRoqBWoHouGaglVhlwZMWZruWpVX6VZd57tWng= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733420489; c=relaxed/simple; bh=EyOxymQJIk4/PgE3cHN9UOvFHsTb3PYBrUtcPQpgL84=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Crnkg9mqwRxHXHr83sqxrRgMoC2+RdBx/LUXaAq8rQt6beDfKsSZe6/r4kvKC7WR+kOcR8+tXKvOVJyzJpbUiivM6FEjK4M6eSkL3zrWFRO8GUBhplkZgAcmhXTZ41XVBrssY2sF4ueCep1vDdvY6eDxers66T6p5LwpTr1EG2c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFCBF3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733420489; bh=EyOxymQJIk4/PgE3cHN9UOvFHsTb3PYBrUtcPQpgL84=; h=From:To:Cc:Subject:Date:From; b=Rlv9QmgDPTgspJglkm0Nr2a5pVqa1WeWHgEXeUAcdL4ep8OqUA5gDnpQ46szD75iO OUN/kd+kzz22qDYvWu/ZzDB7tKtU/2U/xT07vhp4fdxhXAJ8elBnNbHFIpzSR8ucTs 5IDYAm42H1Om7c8f9sH4K7FsdG9DcKs8XhmUP10s= Received: by simark.ca (Postfix, from userid 112) id 68C7C1E197; Thu, 5 Dec 2024 12:41:29 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Spam-Level: X-Spam-Status: No, score=-162.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1733420488; bh=EyOxymQJIk4/PgE3cHN9UOvFHsTb3PYBrUtcPQpgL84=; h=From:To:Cc:Subject:Date:From; b=cNZMECr2pNwwVtEtKA4hCm3+pvE1a8HPkOMRQJ5KCaXmJHWvTERfL3E7ABPh/b2+E ayLpVfRv5x0jMIgzpp9sxXnVMoDE9BhjCLGkVNDXnDysDOhgJODEe+iUzJSM2jq7/Z E0eqKxJ2q1aQwoCs4Yp94T+S1ICcNf2PpP1ciyk8= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4BBAC1E092; Thu, 5 Dec 2024 12:41:28 -0500 (EST) From: simark@simark.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] pre-commit: run flake8 on more Python files Date: Thu, 5 Dec 2024 12:41:21 -0500 Message-ID: <20241205174127.3964750-1-simark@simark.ca> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org From: Simon Marchi 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 --- .pre-commit-config.yaml | 11 ++++++++--- gdb/copyright.py | 25 ++++++++++++------------- gdb/testsuite/analyze-racy-logs.py | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) base-commit: 07868dca1186ab0406840d3f52a4d7fa05aa0e61 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 070631c0f168..8f9016567b02 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,9 +49,14 @@ repos: hooks: - id: flake8 types_or: [file] - # Note this one is only run on gdb/python, not (for now) the - # test suite. - files: 'gdb/python/.*\.py(\.in)?$' + # Run this for (in glob notation): + # + # - gdb/gdb-gdb.py.in + # - gdb/*.py + # - gdb/python/**/*.py + # - gdb/testsuite/*.py + # + files: '^gdb/(gdb-gdb\.py\.in|[^/]+\.py|python/.+\.py|testsuite/[^/]+\.py)$' args: [--config, gdb/setup.cfg] - repo: https://github.com/pycqa/isort rev: 5.13.2 diff --git a/gdb/copyright.py b/gdb/copyright.py index 2c9ea3c1d591..1a155b9cc831 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 5a3f90ed62d0..3863bd07b286 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()