Skip to content

eadm/ktlint-rules

Repository files navigation

ktlint-rules

General

Custom KtLint rules to check some of code style rules

Rules set was originaly developed as a module in https://github.com/StepicOrg/stepik-android repository.

Currently set consists of following rules:

Installation

Github Packages

Add following repository to access binaries

allprojects {
    repositories {
        maven { 
            url = "https://maven.pkg.github.com/eadm/ktlint-rules" 
            credentials {
                username = System.getenv("GITHUB_USER") ?: project.properties["GITHUB_USER"]
                password = System.getenv("GITHUB_PERSONAL_ACCESS_TOKEN") ?: project.properties["GITHUB_PERSONAL_ACCESS_TOKEN"]
            }
        }
    }
}

Dependency

dependencies {
    implementation 'ru.nobird.android.ktlint:rules:1.0.0'
}

And then follow instructions from https://github.com/pinterest/ktlint

Example of ktlint task realisation

Building & testing library

To run rules tests can be used following task

./gradlew ktlint-rules:test

To see ktlint in action for sample app

./gradlew app:ktlint

And to autocorrect

./gradlew app:ktlintFormat

About

Custom KtLint rules to check code style

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages