binutils Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils/build

Refine pre-commit configuration

Pre-commit configuration is updated to reduce duplication and set default file paths.

This commit refactors the .pre-commit-config.yaml file to reduce duplication by using YAML anchors and aliases for hook configurations. It also sets a default files pattern to apply hooks more consistently across Python files in the gdb, gdbserver, and gdbsupport directories. This improves maintainability and reduces redundancy in the pre-commit hook setup.

In Details

The .pre-commit-config.yaml is updated to use YAML anchors and aliases for the check-include-guards hook and a new python-files anchor. This reduces duplication by allowing reusable configuration blocks. A default files setting is also introduced, targeting Python files within gdb/, gdbserver/, and gdbsupport/ directories, and a bug related to duplicate hook definitions is addressed.

For Context
pre-commit
A framework that automates the execution of program code quality checks before commits are made, ensuring code consistency and preventing common errors.
YAML anchors and aliases
Features in YAML that allow defining a block of data once (anchor) and reusing it elsewhere (alias), reducing redundancy in configuration files.
hook
A script or program that runs automatically at a specific point in a process, such as before a code commit, to perform checks or tasks.
configuration file
A file that stores settings and parameters for a program or system, allowing customization of its behavior.
Filed Under: buildCIrefactoring