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

Overview

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 🎉
  • Check whether commit messages are correctly formatted or not

Good Job 💮

You might also like...
BCSwiftTor - Opinionated pure Swift controller for Tor, including full support for Swift 5.5 and Swift Concurrency

BCSwiftTor Opinionated pure Swift controller for Tor, including full support for

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux)

SwiftFoundation Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. Goals Provide a cross-platform in

Swift - ✏️Swift 공부 저장소✏️

Swift 스위프트의 기초 1. Swift의 기본 2. 변수와 상수 [3. 데이터 타입 기본] [4. 데이터 타입 고급] 5. 연산자 6. 흐름 제어 7. 함수 8. 옵셔널 객체지향 프로그래밍과 스위프트 9. 구조체와 클래스 10. 프로퍼티와 메서드 11. 인스턴스 생

Swift-ndi - Swift wrapper around NewTek's NDI SDK

swift-ndi Swift wrapper around NewTek's NDI SDK. Make sure you extracted latest

__.swift is a port of Underscore.js to Swift.

__.swift Now, __.swift is version 0.2.0! With the chain of methods, __.swift became more flexible and extensible. Documentation: http://lotz84.github.

SNTabBarDemo-Swift - Cool TabBar With Swift
SNTabBarDemo-Swift - Cool TabBar With Swift

SNTabBarDemo-Swift Cool TabBar How To Use // MARK: - setup private func setu

Swift-when - Expression switch support in Swift

Swift When - supporting switch expressions in Swift! What is it? Basically, it a

Swift-compute-runtime - Swift runtime for Fastly Compute@Edge

swift-compute-runtime Swift runtime for Fastly Compute@Edge Getting Started Crea

Comments
  • Feature/responsibility refactor

    Feature/responsibility refactor

    A big fix of responsibility refactor:

    • Rename CheckResult to Report
    • Make Report a pure data structure type
    • Add a MarkdownConfiguration type for formatting customization
    • Move formatting implementations to Shoki
    • Tests and README updates due to modifications above
    opened by el-hoshino 0
  • Feature/initial

    Feature/initial

    現在のテンプレにあるDangerfile.swiftから、CheckResultを取り出してプラグイン化した

    さまざまなメッセージを一括でmarkdownにして報告させるので便利かなと思っている

    将来オープンソース化を視野に入れているため、とりあえず一旦内容を英語にしました;ローカライズはまた別のタイミングでやりたいです

    opened by el-hoshino 0
Releases(v0.2.0)
  • v0.2.0(Dec 14, 2021)

    Changes

    Enhanced

    • API Responsibility (#4 )

    CONTAINS API BREAKING CHANGES!!

    Migration Guide from 0.1.x

    | Old API | New API | |---|---| | var result = CheckResult(title: "Result Title") | var report = danger.shoki.makeInitialReport(title: "Report Title") | | result.check("CheckTitle") { return .good } | danger.shoki.check("Check Title", into: &report) { return .good } | | result.check("CheckTitle") { warn("Warning Message"); return .acceptable } | danger.shoki.check("Check Title", into: &report) { return .acceptable(warningMessage: "Warning Message") } | | result.check("CheckTitle") { fail("Failure Message"); return .rejected } | danger.shoki.check("Check Title", into: &report) { return .rejected(failureMessage: "Failure Message") } | | result.askReviewer(to: "Do something") | danger.shoki.askReviewer(to: "Do something", into: &report) |

    You can also check this PR to see how we migrated from 0.1.1 to 0.2.0.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Nov 25, 2021)

  • v0.1.0(Nov 24, 2021)

Owner
YUMEMI Inc.
YUMEMI Inc.
Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Swift Markdown is a Swift package for parsing, building, editing, and analyzing Markdown documents.

Apple 2k Dec 28, 2022
Generate Markdown documentation from source code

SourceDocs SourceDocs is a command line tool that generates markdown documentation files from inline source code comments. Similar to Sphinx or Jazzy,

Eneko Alonso 349 Dec 10, 2022
A library to manage NVRAM Stuff in Swift

libNVRAMSwift A Library to manage NVRAM Stuff, written in Swift. CLI Example utility here Library Usage Declare a new instance of the NVRAM Struct, fo

Serena 7 Sep 25, 2022
Minimalist library to manage one-off operations.

Once(简体中文) Once allows you to manage the number of executions of a task using an intuitive API. Highlight Safe Efficient Persistent Usage Token Token

Luo Xiu 45 Aug 16, 2022
Elegant Apply Style by Swift Method Chain.🌙

ApplyStyleKit ApplyStyleKit is a library that applies styles to UIKit using Swifty Method Chain. Normally, when applying styles to UIView etc.,it is n

shindyu 203 Nov 22, 2022
Basic Style Dictionary With Swift

Basic Style Dictionary This example code is bare-bones to show you what this framework can do. If you have the style-dictionary module installed globa

Tiago Oliveira 1 Nov 24, 2021
Generates Heroku-style random project names in Swift

RandomProjectName.swift Generates Heroku-style random project names in Swift. Usage Just call String.randomProjectName(), and specify the optional suf

NLUDB 0 Dec 6, 2021
Make trains of constraints with a clean style!

Constren ?? . ?? . ?? Make trains of constraints with style! button.constren.centerY() .lead(spacing: 16) .trail(image.l

Doruk Çoban 4 Dec 19, 2021
ObjectiveC additions for humans. Ruby style.

Write Objective C like a boss. A set of functional additions for Foundation you wish you'd had in the first place. Usage Install via CocoaPods pod 'Ob

Marin 2.2k Dec 28, 2022
Extensions which helps to convert objc-style target/action to swifty closures

ActionClosurable Usage ActionClosurable extends UIControl, UIButton, UIRefreshControl, UIGestureRecognizer and UIBarButtonItem. It helps writing swift

takasek 121 Aug 11, 2022