Skip to content

Commit

Permalink
renamed: DangerCommentable to ViolationNotifier
Browse files Browse the repository at this point in the history
  • Loading branch information
taji-taji committed Aug 28, 2022
1 parent 35c2a9d commit c7c9932
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Sources/DangerSwiftPeriphery/DangerDSL+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Danger

extension DangerDSL: DangerCommentable {
extension DangerDSL: ViolationNotifier {
func warn(violation: Violation) {
warn(message: violation.message,
file: violation.filePath,
Expand Down
6 changes: 3 additions & 3 deletions Sources/DangerSwiftPeriphery/DangerPeriphery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public enum DangerPeriphery {
}
}

static func handleScanResult<DC: DangerCommentable>(_ scanResult: Result<[Violation], Error>,
danger: DC,
shouldComment: Bool) {
static func handleScanResult<Notifier: ViolationNotifier>(_ scanResult: Result<[Violation], Error>,
danger: Notifier,
shouldComment: Bool) {
guard shouldComment else { return }
switch scanResult {
case .success(let violations):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

protocol DangerCommentable {
protocol ViolationNotifier {
func warn(violation: Violation)
func fail(_ message: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ final class DangerSwiftPeripheryTests: XCTestCase {
private var scanExecutor: PeripheryScanExecutableMock!
private var outputParser: CheckstyleOutputParsableMock!
private var diffProvider: PullRequestDiffProvidableMock!
private var dangerCommentable: DangerCommentableMock!
private var dangerCommentable: ViolationNotifierMock!

override func setUp() {
super.setUp()

scanExecutor = PeripheryScanExecutableMock()
outputParser = CheckstyleOutputParsableMock()
diffProvider = PullRequestDiffProvidableMock()
dangerCommentable = DangerCommentableMock()
dangerCommentable = ViolationNotifierMock()
}

func testScanErrorOccurredWhileScanning() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Foundation
@testable import DangerSwiftPeriphery

final class DangerCommentableMock: DangerCommentable {
final class ViolationNotifierMock: ViolationNotifier {
var warnHandler: ((Violation) -> Void)?
var failHandler: ((String) -> Void)?
private(set) var warnCallCount = 0
Expand Down

0 comments on commit c7c9932

Please sign in to comment.