Currently, our project uses godot-gdscript-toolkit via pre-commit. We have a block like the following in .pre-commit-config.yaml in our repository:
repos:
- repo: https://github.com/Scony/godot-gdscript-toolkit
rev: 4.3.4
hooks:
- id: gdformat
- id: gdlint
and pre-commit takes care of installing the necessary tools and running them whenever one commits.
The way this works is that https://github.com/Scony/godot-gdscript-toolkit/ contains a .pre-commit-hooks.yaml file which defines the available tools and how to install them. pre-commit has specific support for python modules as hooks.
It also has support for rust hooks but this works by installing them with cargo. I was curious how this is done for ruff, which is a formatter for Python code written in Rust. To my slight surprise https://github.com/astral-sh/ruff-pre-commit defines a Python (not Rust!) module, which depends on the ruff Python package – which is of course a Rust program in a Python's clothing. And because they publish binary wheels for all major platforms, this means you can install ruff without having a Rust compiler...
There's also a system hook type which just relies on the relevant command being installed on the system. That might be OK as a starting point.
Originally posted by @wjt in #138
Originally posted by @wjt in #138