public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Add flake8 and isort to .pre-commit-config.yaml
@ 2024-04-04 12:43 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-04-04 12:43 UTC (permalink / raw)
To: binutils-cvs, gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=16810e455feb26ef826a3ed876d6d7e6d24818b0
commit 16810e455feb26ef826a3ed876d6d7e6d24818b0
Author: Tom Tromey <tromey@adacore.com>
Date: Tue Apr 2 12:04:21 2024 -0600
Add flake8 and isort to .pre-commit-config.yaml
This adds flake8 and isort to .pre-commit-config.yaml. This way, they
will automatically be run on commit.
I chose the most recent available versions after verifying that they
don't cause any reports or changes in the current tree.
Internally at AdaCore, we also use a few flake8 plugins as well, so
perhaps that's another avenue for investigation.
v2: Also update the various file-selection clauses to pick up
gdb-gdb.py.in; include the isort change made to this file; and finally
add a comment about the exclusions from flake8.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diff:
---
.pre-commit-config.yaml | 18 +++++++++++++++++-
gdb/gdb-gdb.py.in | 3 ++-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7afe60c20be..8721dac678b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -5,4 +5,20 @@ repos:
rev: 24.3.0
hooks:
- id: black
- files: 'gdb/.*'
+ types_or: [file]
+ files: 'gdb/.*\.py(\.in)?$'
+ - repo: https://github.com/pycqa/flake8
+ rev: 7.0.0
+ 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)?$'
+ args: [--config, gdb/setup.cfg]
+ - repo: https://github.com/pycqa/isort
+ rev: 5.13.2
+ hooks:
+ - id: isort
+ types_or: [file]
+ files: 'gdb/.*\.py(\.in)?$'
diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in
index 54db9b00cf3..b5a7fa4f390 100644
--- a/gdb/gdb-gdb.py.in
+++ b/gdb/gdb-gdb.py.in
@@ -15,9 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import gdb
import os.path
+import gdb
+
class TypeFlag:
"""A class that allows us to store a flag name, its short name,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-04 12:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-04 12:43 [binutils-gdb] Add flake8 and isort to .pre-commit-config.yaml Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).