Swiftpack.co -  AppDifferentia/danger-swift-commit-lint as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
AppDifferentia/danger-swift-commit-lint
A Danger-Swift plugin to check commit messages.
.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: 0
Last commit: 5 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

v0.1.0
5 days ago

Initial release

Changes

#10 Project clean up (@weisunOW)

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