Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 996 Bytes

README.md

File metadata and controls

29 lines (18 loc) · 996 Bytes

Rules Ktlint

Bazel rules for applying Ktlint, design inspired by Buildifier. Ktlint is a linter and formatter for Kotlin.

Setup and usage

Import this repository (common for all rules, see parent directory README.md).

Add the following code to the WORKSPACE file

load("@nl_tulipsolutions_bazel_tools//rules_ktlint:deps.bzl", "ktlint_dependencies")

ktlint_dependencies()

The following statements placed in a BUILD file will verify the Ktlint rules against all .kt and .kts in a directory recursively.

load("@nl_tulipsolutions_bazel_tools//rules_ktlint:def.bzl", "ktlint")

ktlint(
    name = "ktlint_format",
    format = True,
)

ktlint(
    name = "ktlint_check",
)

Ktlint allows some (limited) additional configuration using a editorconfig file placed in the root of the project.