Skip to content

ema987/pre-commit-kmm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pre-commit hooks for KMM projects

Provides hooks to format Kotlin code using ktlint and Swift code using SwiftFormat

Installation

ktlint and SwiftFormat should be added via Gradle and SPM so you can control their version in your codebase, avoiding someone having a different version on their machine.

  1. Install pre-commit on your machine
  2. Add ktlint-gradle to your project
  3. Add SwiftFormat to your project
  4. Add the following in your .pre-commit-config.yaml:
repos:
  -   repo: https://github.com/ema987/pre-commit-kmm
      rev: master
      hooks:
        -  id: ktlint-format
           fail_fast: true
        -  id: swift-format
           fail_fast: true

Notes:

  • change rev to another tag or specific commit if needed
  • SwiftFormat can also run on Linux machines if you install Swift first. See Install Swift on Linux for GitHub actions.
  • if you want all the hooks to run even if there is an error in a previos one, remove the fail_fast param, it defaults to false

About

Provides hooks to format Kotlin and Swift code in a KMM project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages