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.3.0
A danger-swift plug-in to manage/post danger checking reports with markdown style
⭐️ 4
🕓 20 weeks ago
.package(url: "https://github.com/yumemi-inc/danger-swift-shoki.git", from: "v0.3.0")

CI

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

Basically just use .shoki property from a DangerDSL instance to access all features provided by DangerSwiftShoki

Examples below assume you have initialized a danger using Danger() in your Dangerfile.swift

  • First of all create a report data structure with makeInitialReport method

    var report = danger.shoki.makeInitialReport(title: "My Report")
    
  • Then you can perform any checks with check method, by returning your check result in the trailing execution closure

    danger.shoki.check("Test Result Check", into: &report) {
        if testPassed {
            return .good
            
        } else {
            if isAcceptable {
                return .acceptable(warningMessage: "Encouraged to make a change but OK at this time")
                
            } else {
                return .rejected(failureMessage: "Must fix")
            }
        }
    }
    
  • You can also ask reviewers not to forget to do some manual checks with askReviewer method if needed

    danger.shoki.askReviewer(to: "Check whether commit messages are correctly formatted or not", into: $report)
    
  • At last post the whole check result with report method

    danger.shoki.report(report)
    

Preview

Code above will make danger producing markdown messages like below

My Report

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

Good Job :white_flower:

GitHub

link
Stars: 4
Last commit: 13 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

0.3.0
20 weeks ago

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