Skip to content

pre-commit support #75

Description

@lwbt

Please consider exiting with a different status than 0 when issues have been found. This would make it easier to use systemdlint for things like the https://pre-commit.com/ framework.

At the moment, instead of just calling the program, I have to do some ugly scripting:

repos:
  - repo: local
    hooks:
      - id: systemdlint
        name: Systemd Unit Lint
        #entry: systemdlint
        entry: bash -c 'OUTPUT=$(systemdlint "$@" 2>&1); EXIT_CODE=$?; echo "$OUTPUT"; if [[ -n "$(echo "$OUTPUT" | grep -v "^$")" ]]; then exit 1; else exit 0; fi' --
        language: system
        files: \.(service|socket|device|mount|automount|swap|target|path|timer|slice|scope)$
        require_serial: true

An official pre-commit hook would also be nice by the way, may be you find this example helpful: https://github.com/scop/pre-commit-shfmt/blob/main/.pre-commit-hooks.yaml

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