danger-kotlin-commit-lint

Plugin for danger-kotlin linting your commits

License

License

Categories

Categories

Kotlin Languages
GroupId

GroupId

io.github.ackeecz
ArtifactId

ArtifactId

danger-kotlin-commit-lint
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

danger-kotlin-commit-lint
Plugin for danger-kotlin linting your commits
Project URL

Project URL

https://github.com/AckeeCZ/danger-kotlin-detekt

Download danger-kotlin-commit-lint

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.30
systems.danger : danger-kotlin-sdk jar 1.2

Project Modules

There are no modules declared in this project.

Maven Central

danger-kotlin commit lint plugin

This is a plugin for danger-kotlin that checks if commit messages align with recommendations specified eg. here

Installation

Put

@file:DependsOn("io.github.ackeecz:danger-kotlin-commit-lint:x.y.z")

to the top of your Dangerfile

Usage

There is a single method CommitLintPlugin.check that will perform validations on the commits.

Due to a design of danger-kotlin plugin SDK it does not have access to commits directly and for that reason you need to pass messages to the plugin manually.

register CommitLintPlugin

    danger(args) {
        CommitLintPlugin.check(commits = git.commits.map { gitCommit ->
            Commit(CommitMessage.fromRawMessage(gitCommit.message), gitCommit.sha ?: "")
        })
    }

Rules specification

You can enable only some rules by passing them to the check function. By default, there are these rules:

Name Description
SUBJECT_LENGTH Length of the subject is less than 50 characters
BODY_LENGTH Length of the body is less than 72 characters
SUBJECT_BODY_NEW_LINE Subject and body is separated with newline
SUBJECT_CAPITALIZE Subject should start with capital letter
SUBJECT_MULTIPLE_WORDS Subject have more than one word
SUBJECT_ENDS_WITH_PERIOD Subject does not ends with a period

If you want to disable some rules you can do

CommitLintPlugin.check(commits, Rule.values().toList() - Rule.SUBJECT_CAPITALIZE)

GitMoji first

GitMoji characters are skipped in the beginning for SUBJECT_CAPITALIZE and SUBJECT_MULTIPLE_WORDS rules.

io.github.ackeecz

Ackee

Software development enthusiasts from the ❤️ of Europe.

Versions

Version
0.1.0