A pre-commit hook to run the Runic.jl code formatter.
Install pre-commit (installation instructions) and add
the following to your .pre-commit-config.yaml file:
repos:
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v2.2.0
hooks:
- id: runicTo also format Julia code blocks in Markdown files, add the runic-md hook (requires Runic
= 1.7):
repos:
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v2.2.0
hooks:
- id: runic
- id: runic-mdBy default this will configure the hook to run with the latest Runic version available at
hook installation time. To explicitly configure a version of Runic you can use pre-commits
additional_dependencies configuration, for example to use Runic version 1.4.3:
repos:
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v2.2.0
hooks:
- id: runic
additional_dependencies:
- 'Runic@1.4.3'By default pre-commit runs runic with the --inplace and --diff flags. This means
that, after pre-commit runs, files will be left modified. If you prefer running in check
mode you can override the default flags using args:
repos:
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v2.2.0
hooks:
- id: runic
args: ["--check", "--diff"]To also format Julia code blocks in docstrings, add --docstrings to the args (requires
Runic >= 1.7):
repos:
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v2.2.0
hooks:
- id: runic
args: ["--inplace", "--diff", "--docstrings"]Note
The current version (v2.0.0 and above) of this repository make use of Julia language hooks which require pre-commit version 4.1.0 or later. If you cannot upgrade pre-commit you can use version v1.0.0 of this repository instead.