Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] [pre-commit] Use yamllint
@ 2026-07-17 14:25 Tom de Vries
  2026-07-17 14:25 ` [PATCH 1/2] [pre-commit] Fix yamllint errors in .pre-commit-config.yaml Tom de Vries
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom de Vries @ 2026-07-17 14:25 UTC (permalink / raw)
  To: gdb-patches

I came across a formatting inconsistency in .pre-commit-config.yaml and
investigated if there were pre-commit tools that could help with that.

I found yamllint [1].

The first patch fixes yamllint errors.

The second patch adds a pre-commit hook to check .pre-commit-config.yaml using yamllint.

[1] https://github.com/adrienverge/yamllint

Tom de Vries (2):
  [pre-commit] Fix yamllint errors in .pre-commit-config.yaml
  [pre-commit] Add yamllint hook

 .pre-commit-config.yaml | 120 +++++++++++++++++++++-------------------
 1 file changed, 64 insertions(+), 56 deletions(-)


base-commit: 0cdde1399d2d453569fe91c55b34b4879f8a6501
-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] [pre-commit] Fix yamllint errors in .pre-commit-config.yaml
  2026-07-17 14:25 [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries
@ 2026-07-17 14:25 ` Tom de Vries
  2026-07-17 14:25 ` [PATCH 2/2] [pre-commit] Add yamllint hook Tom de Vries
  2026-07-28  7:36 ` [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-07-17 14:25 UTC (permalink / raw)
  To: gdb-patches

I ran yamllint [1] on .pre-commit-config.yaml and ran into a few errors:
- missing document start marker
- indentation errors
- white space error

Fix these.

With git show -w, the only change is adding the missing document start marker.

[1] https://github.com/adrienverge/yamllint
---
 .pre-commit-config.yaml | 113 ++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 56 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 141f14ba72c..957c896e66e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -37,6 +37,7 @@
 # See https://pre-commit.com for more information
 # See https://pre-commit.com/hooks.html for more hooks
 
+---
 minimum_pre_commit_version: 4.5.1
 default_install_hook_types: [pre-commit, commit-msg]
 default_stages: [pre-commit]
@@ -58,78 +59,78 @@ repos:
   - repo: https://github.com/psf/black-pre-commit-mirror
     rev: 26.5.1
     hooks:
-    - id: black
-      types_or: &gdb_python_types [file]
-      files: &gdb_python_files '^gdb/.*\.py(\.in)?$'
-  - repo:  https://github.com/pycqa/flake8
+      - id: black
+        types_or: &gdb_python_types [file]
+        files: &gdb_python_files '^gdb/.*\.py(\.in)?$'
+  - repo: https://github.com/pycqa/flake8
     rev: 7.3.0
     hooks:
-    - id: flake8
-      types_or: *gdb_python_types
-      files: *gdb_python_files
-      args: [--config, gdb/setup.cfg]
+      - id: flake8
+        types_or: *gdb_python_types
+        files: *gdb_python_files
+        args: [--config, gdb/setup.cfg]
   - repo: https://github.com/pycqa/isort
     rev: 9.0.0b1
     hooks:
-    - id: isort
-      types_or: *gdb_python_types
-      files: *gdb_python_files
+      - id: isort
+        types_or: *gdb_python_types
+        files: *gdb_python_files
 
   # Codespell hooks.
   - repo: https://github.com/codespell-project/codespell
     rev: v2.4.3
     hooks:
-    - id: codespell
-      args: &codespell_args [--toml, gdb/pyproject.toml]
-      files: &gdb_files '^(gdb|gdbserver|gdbsupport)/'
-    - id: codespell
-      name: codespell-log
-      entry: gdb/contrib/codespell-log.sh
-      args: *codespell_args
-      verbose: true
-      stages: [commit-msg]
+      - id: codespell
+        args: &codespell_args [--toml, gdb/pyproject.toml]
+        files: &gdb_files '^(gdb|gdbserver|gdbsupport)/'
+      - id: codespell
+        name: codespell-log
+        entry: gdb/contrib/codespell-log.sh
+        args: *codespell_args
+        verbose: true
+        stages: [commit-msg]
 
   # Tclint hooks.
   - repo: https://github.com/nmoroze/tclint
     rev: v0.8.0
     hooks:
-    - id: tclint
-      args: [--trust-plugins]
-      files: '^gdb/testsuite/.*\.(exp|tcl)$'
+      - id: tclint
+        args: [--trust-plugins]
+        files: '^gdb/testsuite/.*\.(exp|tcl)$'
 
   # Local hooks.
   - repo: local
     hooks:
-    - id: &id0 check-include-guards
-      name: *id0
-      language: unsupported_script
-      entry: gdb/check-include-guards.py
-      # All gdb header files, but not headers in the test suite.
-      files: '^(gdb(support|server)?)/.*\.h$'
-      exclude: '.*/testsuite/.*'
-    - id: &id1 check-gnu-style
-      name: *id1
-      language: python
-      additional_dependencies: ['termcolor', 'unidiff']
-      entry: gdb/contrib/check-gnu-style-pre-commit.sh
-      files: '^(gdb(support|server)?)/.*\.(c|h|cc)$'
-      exclude: '.*/testsuite/.*'
-      verbose: true
-    - id: &id2 check-whitespace
-      name: *id2
-      language: unsupported_script
-      entry: gdb/contrib/check-whitespace-pre-commit.py
-      types: ['text']
-      files: *gdb_files
-    - id: &id3 pre-commit-setup
-      name: *id3
-      language: python
-      entry: gdb/contrib/pre-commit-setup.py
-      additional_dependencies: ["pyyaml"]
-      always_run: true
-      pass_filenames: false
-    - id: &id4 check-file-mode
-      name: *id4
-      language: unsupported_script
-      entry: gdb/contrib/check-file-mode.sh
-      files: *gdb_files
+      - id: &id0 check-include-guards
+        name: *id0
+        language: unsupported_script
+        entry: gdb/check-include-guards.py
+        # All gdb header files, but not headers in the test suite.
+        files: '^(gdb(support|server)?)/.*\.h$'
+        exclude: '.*/testsuite/.*'
+      - id: &id1 check-gnu-style
+        name: *id1
+        language: python
+        additional_dependencies: ['termcolor', 'unidiff']
+        entry: gdb/contrib/check-gnu-style-pre-commit.sh
+        files: '^(gdb(support|server)?)/.*\.(c|h|cc)$'
+        exclude: '.*/testsuite/.*'
+        verbose: true
+      - id: &id2 check-whitespace
+        name: *id2
+        language: unsupported_script
+        entry: gdb/contrib/check-whitespace-pre-commit.py
+        types: ['text']
+        files: *gdb_files
+      - id: &id3 pre-commit-setup
+        name: *id3
+        language: python
+        entry: gdb/contrib/pre-commit-setup.py
+        additional_dependencies: ["pyyaml"]
+        always_run: true
+        pass_filenames: false
+      - id: &id4 check-file-mode
+        name: *id4
+        language: unsupported_script
+        entry: gdb/contrib/check-file-mode.sh
+        files: *gdb_files
-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] [pre-commit] Add yamllint hook
  2026-07-17 14:25 [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries
  2026-07-17 14:25 ` [PATCH 1/2] [pre-commit] Fix yamllint errors in .pre-commit-config.yaml Tom de Vries
@ 2026-07-17 14:25 ` Tom de Vries
  2026-07-28  7:36 ` [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-07-17 14:25 UTC (permalink / raw)
  To: gdb-patches

Add pre-commit check linting .pre-commit-config.yaml using yamllint.

[1] https://github.com/adrienverge/yamllint
---
 .pre-commit-config.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 957c896e66e..e07b9b99620 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -98,6 +98,13 @@ repos:
         args: [--trust-plugins]
         files: '^gdb/testsuite/.*\.(exp|tcl)$'
 
+  # Yaml hooks.
+  - repo: https://github.com/adrienverge/yamllint.git
+    rev: v1.38.0
+    hooks:
+      - id: yamllint
+        files: '^\.pre-commit-config.yaml$'
+
   # Local hooks.
   - repo: local
     hooks:
-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] [pre-commit] Use yamllint
  2026-07-17 14:25 [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries
  2026-07-17 14:25 ` [PATCH 1/2] [pre-commit] Fix yamllint errors in .pre-commit-config.yaml Tom de Vries
  2026-07-17 14:25 ` [PATCH 2/2] [pre-commit] Add yamllint hook Tom de Vries
@ 2026-07-28  7:36 ` Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2026-07-28  7:36 UTC (permalink / raw)
  To: gdb-patches

On 7/17/26 4:25 PM, Tom de Vries wrote:
> I came across a formatting inconsistency in .pre-commit-config.yaml and
> investigated if there were pre-commit tools that could help with that.
> 
> I found yamllint [1].
> 
> The first patch fixes yamllint errors.
> 
> The second patch adds a pre-commit hook to check .pre-commit-config.yaml using yamllint.
> 

I came across a Red Hat Blog post "Check your YAML for errors with 
yamllint"  ( https://www.redhat.com/en/blog/check-yaml-yamllint ).

I'll consider that a review.

I'm pushing this.

Thanks,
- Tom

> [1] https://github.com/adrienverge/yamllint
> 
> Tom de Vries (2):
>    [pre-commit] Fix yamllint errors in .pre-commit-config.yaml
>    [pre-commit] Add yamllint hook
> 
>   .pre-commit-config.yaml | 120 +++++++++++++++++++++-------------------
>   1 file changed, 64 insertions(+), 56 deletions(-)
> 
> 
> base-commit: 0cdde1399d2d453569fe91c55b34b4879f8a6501


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-28  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-17 14:25 [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries
2026-07-17 14:25 ` [PATCH 1/2] [pre-commit] Fix yamllint errors in .pre-commit-config.yaml Tom de Vries
2026-07-17 14:25 ` [PATCH 2/2] [pre-commit] Add yamllint hook Tom de Vries
2026-07-28  7:36 ` [PATCH 0/2] [pre-commit] Use yamllint Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox