]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add flake8 and isort to .pre-commit-config.yaml
authorTom Tromey <tromey@adacore.com>
Tue, 2 Apr 2024 18:04:21 +0000 (12:04 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 4 Apr 2024 12:43:39 +0000 (06:43 -0600)
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>
.pre-commit-config.yaml
gdb/gdb-gdb.py.in

index 7afe60c20be94345805affad9c0292bd70bdfb39..8721dac678b865dc53c4f19599e40afba1d08894 100644 (file)
@@ -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)?$'
index 54db9b00cf3663c7674d946992d2daaa9e2afb00..b5a7fa4f39034dd74fee7ebf349c9a14f827d102 100644 (file)
 # 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,