Swiftpack.co - yumemi-inc/danger-swift-shoki as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by yumemi-inc.
yumemi-inc/danger-swift-shoki v0.1.1
A danger-swift plug-in to manage/post danger checking results with markdown style
⭐️ 2
🕓 4 days ago
.package(url: "https://github.com/yumemi-inc/danger-swift-shoki.git", from: "v0.1.1")

DangerSwiftShoki

A danger-swift plug-in to manage/post danger checking results with markdown style

Install DangerSwiftShoki

SwiftPM (Recommended)

  • Add dependency package to your Package.swift file which you import danger-swift

    // swift-tools-version:5.5
    ...
    let package = Package(
        ...
        dependencies: [
            ...
            // Danger Plugins
            .package(name: "DangerSwiftShoki", url: "https://www.github.com/yumemi-inc/danger-swift-shoki.git", from: "0.1.0"),
            ...
        ],
        ...
    )
    
  • Add the correct import to your Dangerfile.swift file

    import DangerSwiftShoki
    

Marathon (Tool Deprecated)

  • Just add the dependency import to your Dangerfile.swift file like this:

    import DangerSwiftShoki // package: https://github.com/yumemi-inc/danger-swift-shoki.git
    

Usage

  • First of all create a result data structure with CheckResult initializer

    var checkResult = CheckResult(title: "My Check")
    
  • Then you can perform any check with check method, by returning your check result in the trailing execution closure

    checkResult.check("Test Result Check") {
        if testPassed {
            return .good
            
        } else {
            if isAcceptable {
                warn("Encouraged to make a change but OK at this time")
                return .acceptable
                
            } else {
                fail("Must fix")
                return .rejected
            }
        }
    }
    
  • You can also ask reviewers not to forget to do some manual checks with askReviewer method if needed

    checkResult.askReviewer(to: "Check whether commit messages are correctly formatted or not")
    
  • At last post the whole check result with shoki.report method which is available for DangerDSL instances

    danger.shoki.report(checkResult) // Assume you have initialized `danger` by code like `let danger = Danger()`
    

Preview

Code above will make danger producing markdown messages like below

My Check

Checking Item Result
Test Result Check :tada:
  • ☐ Check whether commit messages are correctly formatted or not

Good Job :white_flower:

GitHub

link
Stars: 2
Last commit: 4 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

0.1.1
4 days ago

Enhanced

  • Add details to README.md

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