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

Add Docker pre-commit hook #1863

Closed
allie-jo opened this issue Nov 4, 2022 · 4 comments · Fixed by #1864
Closed

Add Docker pre-commit hook #1863

allie-jo opened this issue Nov 4, 2022 · 4 comments · Fixed by #1864

Comments

@allie-jo
Copy link
Contributor

allie-jo commented Nov 4, 2022

Is your feature request related to a problem? Please describe.
We've been using clj-kondo as a pre-commit hook in many of our projects, but in order to preempt users from having to install all of the dependencies for each pre-commit hook (including clj-kondo) we've been using Docker images instead. Because we do this manually using the local section of our pre-commit-config, we have to update the version manually. It would be great if the repo provided a docker hook directly so we can have CI run pre-commit autoupdate to update versions periodically automatically.

Describe the solution you'd like
Add a Docker hook in .pre-commit-hooks.yaml, pinned to the currently published docker version of clj-kondo. We've been using:

  - id: clj-kondo-docker
    name: clj-kondo (via docker)
    entry: cljkondo/clj-kondo:2022.11.03
    args: [clj-kondo, --lint]
    language: docker_image
    types: [clojure]

In our projects successfully for a while now. Would need to templatize .pre-commit-hooks.yaml but otherwise is a small change.

Additional context
How we're using clj-kondo in our pre-commits currently:

repos:
  ...
  ...
  - repo: local
    hooks:
      - id: clj-kondo
        name: clj-kondo (via docker)
        entry: cljkondo/clj-kondo:2022.11.03
        args: [clj-kondo, --lint]
        language: docker_image
        types: [clojure]

Happy to do this PR myself :)

@borkdude
Copy link
Member

borkdude commented Nov 4, 2022

Does this mean that current users of the config suddenly will have to use Docker?

@allie-jo
Copy link
Contributor Author

allie-jo commented Nov 4, 2022

nope! it's just another option.
if you wanna use the current executable based hook

repos:
  - repo: https://github.com/clj-kondo/clj-kondo.git
    rev: v2022.11.02
    hooks:
      - id: clj-kondo

and if you wanna use the docker version

repos:
  - repo: https://github.com/clj-kondo/clj-kondo.git
    rev: v2022.11.02
    hooks:
      - id: clj-kondo-docker

@allie-jo
Copy link
Contributor Author

allie-jo commented Nov 4, 2022

hadolint does something similar, but they don't pin their docker version which causes some issues

@borkdude
Copy link
Member

borkdude commented Nov 4, 2022

nope! it's just another option.

If that's the case, PR welcome!

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

Successfully merging a pull request may close this issue.

2 participants