Skip to content

Example hook config for vala #67

Description

@ppvan

Pre-commit does not find stagged vala file.
As I saw you comment here, it seems that this hook does not work with vala

# D, vala currently aren't valid file types. See https://github.com/pre-commit/identify/issues/258

I just want to get a comfirm before going in the rabbit hole, is this possible?

Activity

  1. pocc commented on Aug 23, 2026

    @pocc
    Owner

    uncrustify itself supports Vala, and the hook's description lists it. The blocker is that pre-commit's identify library does not tag .vala files — tags_from_filename('foo.vala') returns [] (verified on identify 2.6.16) — so the hook cannot list vala in types_or, and pre-commit reports (no files to check) Skipped.

    Until identify tags Vala, override the matcher in your own config, since pre-commit lets a consumer replace types_or/files:

    - id: uncrustify
      types_or: [text]
      files: \.vala$

    Two notes from testing this against rev: v1.3.5:

    • Both keys are required. files: \.vala$ on its own does not work — the manifest's types_or still applies and the hook is skipped.
    • No -l VALA arg is needed. uncrustify infers the language from the extension (do_source_file: Parsing: hello.vala as language VALA). An earlier version of this comment suggested args: [-l, VALA]; that is unnecessary, and it would break the config for anyone who widens files beyond .vala.

    Upstream status, since the link in the yaml was stale: pre-commit/identify#258 was closed back in 2021. pre-commit/identify#549 later added both .d and .vala, but was closed unmerged — .d was rejected as ambiguous, while .vala was explicitly acknowledged as unambiguous. So a vala-only PR to identify would likely land.

    Keeping this open until that happens. The yaml comment has been updated to point at #549 and to document the override above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions