Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit support #75

Open
lwbt opened this issue Nov 23, 2024 · 1 comment
Open

pre-commit support #75

lwbt opened this issue Nov 23, 2024 · 1 comment

Comments

@lwbt
Copy link

lwbt commented Nov 23, 2024

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

@priv-kweihmann
Copy link
Owner

Partial duplicate of #73 - but pre-commit support might be a good idea for a 2.0

@priv-kweihmann priv-kweihmann changed the title Consider exiting with a different status than 0 when issues have been found pre-commit support Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants