Skip to content

davehadley/ktfmt-pre-commit-hook

ktfmt-pre-commit-hook

Main Build status Develop status License Last commit Last release

A pre-commit hook to run ktfmt.

Requirements

This commit hook requires Python >=3.8.

ktfmt requires Java 11. The java in your PATH must be version >=11.

Usage Instructions

Add the following lines to your .pre-commit-config.yaml.

- repo: https://github.com/davehadley/ktfmt-pre-commit-hook
  rev: 0.7.0
  hooks:
  - id: ktfmt
    stages: [commit]

To specify a specific version of ktfmt pass --version=XX.YY.ZZ with the args option. All other args provided will be passed onto ktfmt. For example:

- repo: https://github.com/davehadley/ktfmt-pre-commit-hook
  rev: 0.7.0
  hooks:
  - id: ktfmt
    args: [--version=0.39, --dropbox-style]
    stages: [commit]

See the ktfmt documentation for supported command line arguments.

Please report any bugs in the issue tracker.

Development Instructions

Environment Setup

Run source setup.sh to setup the development environment. This may be slow the first time that this is run as the virtual environment is created and dependencies are installed.

Testing

Run:

poetry install
poetry run pytest tests

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.