Swiftpack.co - AppDifferentia/danger-swift-commit-lint as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by AppDifferentia.
AppDifferentia/danger-swift-commit-lint v0.1.0
A Danger-Swift plugin to check commit messages.
⭐️ 1
🕓 2 years ago
.package(url: "https://github.com/AppDifferentia/danger-swift-commit-lint.git", from: "v0.1.0")

Commit Lint For Danger-Swift

License

A danger-swift plugin to check each commit messages on the branch. This project is inspired by danger-commit-lint and its commit linting rules are ported too.

Installation

Add DangerSwiftCommitLint to your Package.file

.package(url: "https://github.com/AppDifferentia/danger-swift-commit-lint", from: "0.0.1")

Usage

Simply add the following lines to your Dangerfile.swift

import Danger

let danger = Danger()

//...

let commitLint = DangerSwiftCommitLint(danger: danger)
commitLint.check()

That will check each commit in the PR to ensure the following is true:

By default, Commit Lint fails, but you can configure this behavior.

E.g.

import Danger

let danger = Danger()

//...

let configuration = DangerSwiftCommitLint.Configuration(warn: .all)
let commitLint = DangerSwiftCommitLint(danger: danger, configuration: configuration)
commitLint.check()

Configuration

The commit lint can be configured with following 5 parameters.

  • disabled: can be .all or .selected([ ... ]), see Configuration.swift
  • warn: can be .all or .selected([ ... ]), see Configuration.swift
  • fail: can be .all or .selected([ ... ]), see Configuration.swift
  • limit: limits the number commits to lint. E.g. limit: 1 will limit the commit to the oldest commit on the branch
  • custom: allow caller to pass an array of custom linter that conforms to CommitLint protocol

E.g.

struct Configuration {

    init(
        disabled: CommitLintSelection = .selected([]),
        warn: CommitLintSelection = .selected([]),
        fail: CommitLintSelection = .all,
        limit: Int = 0,
        custom: [CommitLint.Type] = []
    ) {
        // ...
    }

}

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v0.1.0
2 years ago

Initial release

Changes

#10 Project clean up (@weisunOW)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics