The script has become quite big so it is easier to maintain it in Rust
to add new features.
Ideally we would declare it as a single file cargo script, but that
still requires the nightly toolchain. So we make it a separate checks
crate with no dependencies, to make compilation fast.
It is a separate crate instead of a member of the workspace because
cargo insists on downloading the git dependencies of the fractal crate
before building the checks crate, which adds 20-30 seconds to the first
compilation. Sadly that means the IDEs will probably not be very helpful
when modifying it, and cargo commands run from the root of the workspace
need to point explicitly to the manifest with the `--manifest-path`
argument.
It is pre-compiled during `meson setup` and a symlink is created at
`hooks/checks-bin`, that is used by the pre-commit hook. It is a
requirement for me because I use different environments to compile
crates and to commit changes.
Incidentally, this fixes the check about sorting the POTFILEs
alphabetically.
$Could did not exist, and $Failed was not used, so we replace $Failed by
$Could_not and use it instead of $Could
The conditions for calling check_resources for stage files were wrong,
they were only checking the resource if it was NOT staged, because if
was checking for the empty string instead of the non-empty string.
Since we already have the list of staged files from the check before, we
just check if the resource file is present in it or not.
The name of the file for Blueprint resources changed, so we fix it, and
the `ui-resources.gresource.xml` file doesn't exist anymore so we
remove its check.
To the pre-commit checks, we add the checks about translatable strings,
as well as the check about sorting in blp-resources.in.
We also run `blueprint-compiler format` in CI to make sure that we have
consistent formatting.