domluna / JuliaFormatter.jl

An opinionated code formatter for Julia. Plot twist - the opinion is your own.
https://domluna.github.io/JuliaFormatter.jl/dev/
MIT License
560 stars 65 forks source link

Consider allowing an argument to the pre-commit hook to give the project #842

Open abelsiqueira opened 1 month ago

abelsiqueira commented 1 month ago

This line:

https://github.com/domluna/JuliaFormatter.jl/blob/0208ed4ea5b4d313ed4a0dc322c4334185bd487f/.pre-commit-hooks.yaml#L3

Could be changed to include --project=X where X is some argument to the pre-commit hook. It would allow people that install JuliaFormatter on a separate global environment.

m-fila commented 1 month ago

This can be done already by specifying args in your pre-commit-config.yaml. For instance

repos:
  - repo: https://github.com/domluna/JuliaFormatter.jl.git
    rev: v1.0.56
    hooks:
    -   id: "julia-formatter"
        args: ["--project=/tmp/X"]
abelsiqueira commented 1 month ago

Thanks! I didn't know that was already possible. @dpo, I think this solves your use case?