sleek icon indicating copy to clipboard operation
sleek copied to clipboard

Pre-commit support needed

Open ywang512 opened this issue 9 months ago • 1 comments

Can you add a hook to be used by pre-commit? Thank you

ywang512 avatar Jul 08 '25 19:07 ywang512

There was a PR for this previously in #93.

I'd be happy if we could get (something like) this merged, because it makes using pre-commit with sleek quite a bit easier. With that merged, I can just do this in my repo:

  - repo: https://github.com/nrempel/sleek.git
    rev: 1923b0618fd64f5aaab54dd2c3f6e94b72094104 # v0.5.0
    hooks:
      - id: sleek

That automatically installs sleek from the pinned hash, and takes care of caching and stuff like that. The alternative is to have something like this:

  - repo: local
    hooks:
      - id: sleek
        name: Format SQL with sleek
        entry: sleek
        language: system
        types: [sql]

But that relies on the user to install sleek, which makes the development experience quite a bit less nice.

It's also possible for someone else to create repository that contains a hook, but that's either a downstream fork of sleek that carries this patch, or something that utilizes the docker supports of pre-commit. Neither of these is great. Just to be clear: I think this is primarily a shortcoming of pre-commit, and the proper thing to do here would be to fix this in pre-commit, but that's a lot more complicated sadly.

@nrempel do you have a strong reason against getting this merged? I'd prefer not to have a downstream fork just for that single file.

jcgruenhage avatar Oct 23 '25 12:10 jcgruenhage