https://github.com/yumemi-inc/danger-swift-shoki
A danger-swift plug-in to manage/post danger checking reports with markdown style
https://github.com/yumemi-inc/danger-swift-shoki
Last synced: 4 months ago
JSON representation
A danger-swift plug-in to manage/post danger checking reports with markdown style
- Host: GitHub
- URL: https://github.com/yumemi-inc/danger-swift-shoki
- Owner: yumemi-inc
- License: mit
- Created: 2021-11-10T13:14:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-11T23:39:35.000Z (11 months ago)
- Last Synced: 2024-05-22T19:12:51.547Z (11 months ago)
- Language: Swift
- Homepage:
- Size: 43 KB
- Stars: 4
- Watchers: 10
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-danger - danger-swift-shoki - A danger-swift plug-in to manage/post danger checking reports with markdown style (Plugins / Swift (danger-swift))
README
[](https://github.com/yumemi-inc/danger-swift-shoki/actions/workflows/ci.yml)
[](https://swiftpackageindex.com/yumemi-inc/danger-swift-shoki)
[](https://swiftpackageindex.com/yumemi-inc/danger-swift-shoki)# 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
// 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
```swift
import DangerSwiftShoki
```### Marathon ([Tool Deprecated](https://github.com/JohnSundell/Marathon))
- Just add the dependency import to your `Dangerfile.swift` file like this:
```swift
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
```swift
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
```swift
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
```swift
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
```swift
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: