Skip to content

fredrikekre/runic-pre-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runic-pre-commit

A pre-commit hook to run the Runic.jl code formatter.

Usage

Julia files

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: runic

Markdown files

To 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-md

Configuration

Runic version

By 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'

Runic arguments

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"]

Docstrings

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages