From 0fd36b85544025de476773e4998da0cdbd8a35ee Mon Sep 17 00:00:00 2001 From: Yutaka Date: Mon, 12 Sep 2022 21:28:52 +0900 Subject: [PATCH] add comment for public interface --- .../DangerPeriphery.swift | 54 +++++++++++++++++++ .../PeripheryArguments.swift | 1 + Sources/DangerSwiftPeriphery/Violation.swift | 1 + 3 files changed, 56 insertions(+) diff --git a/Sources/DangerSwiftPeriphery/DangerPeriphery.swift b/Sources/DangerSwiftPeriphery/DangerPeriphery.swift index f41d656..eeb8e6c 100644 --- a/Sources/DangerSwiftPeriphery/DangerPeriphery.swift +++ b/Sources/DangerSwiftPeriphery/DangerPeriphery.swift @@ -8,6 +8,24 @@ import Danger public enum DangerPeriphery { + /// Run `periphery scan` to detect unused code in the diff. + /// + /// - Parameters: + /// - peripheryExecutable: + /// Path to periphery executable. + /// By default, the Periphery shipped with DangerSwiftPeriphery is used. + /// Specify this parameter if you want to use a pre-installed Periphery. + /// Example: `/usr/local/bin/periphery` + /// - arguments: + /// periphery options. + /// - shouldComment: + /// Flag if you want to comment using Danger or not. + /// Set to false if you want to use the return value to create your own comments, for example. + /// - verbose: + /// Set to true if logging is to be output. + /// - Returns: + /// If scan succeeds, it returns a list of violations detected by Periphery. + /// If scan fails, it throws an error. @discardableResult public static func scan(peripheryExecutable: String = "swift run periphery", @PeripheryArgumentsBuilder arguments: () -> [String], @@ -19,6 +37,24 @@ public enum DangerPeriphery { verbose: verbose) } + /// Run `periphery scan` to detect unused code in the diff. + /// + /// - Parameters: + /// - peripheryExecutable: + /// Path to periphery executable. + /// By default, the Periphery shipped with DangerSwiftPeriphery is used. + /// Specify this parameter if you want to use a pre-installed Periphery. + /// Example: `/usr/local/bin/periphery` + /// - arguments: + /// periphery options. + /// - shouldComment: + /// Flag if you want to comment using Danger or not. + /// Set to false if you want to use the return value to create your own comments, for example. + /// - verbose: + /// Set to true if logging is to be output. + /// - Returns: + /// If scan succeeds, it returns a list of violations detected by Periphery. + /// If scan fails, it throws an error. @discardableResult public static func scan(peripheryExecutable: String = "swift run periphery", arguments: [PeripheryArguments], @@ -30,6 +66,24 @@ public enum DangerPeriphery { verbose: verbose) } + /// Run `periphery scan` to detect unused code in the diff. + /// + /// - Parameters: + /// - peripheryExecutable: + /// Path to periphery executable. + /// By default, the Periphery shipped with DangerSwiftPeriphery is used. + /// Specify this parameter if you want to use a pre-installed Periphery. + /// Example: `/usr/local/bin/periphery` + /// - arguments: + /// periphery options. + /// - shouldComment: + /// Flag if you want to comment using Danger or not. + /// Set to false if you want to use the return value to create your own comments, for example. + /// - verbose: + /// Set to true if logging is to be output. + /// - Returns: + /// If scan succeeds, it returns a list of violations detected by Periphery. + /// If scan fails, it throws an error. @discardableResult public static func scan(peripheryExecutable: String = "swift run periphery", arguments: [String] = [], diff --git a/Sources/DangerSwiftPeriphery/PeripheryArguments.swift b/Sources/DangerSwiftPeriphery/PeripheryArguments.swift index 0dfdc2b..05152eb 100644 --- a/Sources/DangerSwiftPeriphery/PeripheryArguments.swift +++ b/Sources/DangerSwiftPeriphery/PeripheryArguments.swift @@ -4,6 +4,7 @@ import Foundation +/// periphery scan command options public enum PeripheryArguments { case config(String) case workspace(String) diff --git a/Sources/DangerSwiftPeriphery/Violation.swift b/Sources/DangerSwiftPeriphery/Violation.swift index bd65fb5..348568e 100644 --- a/Sources/DangerSwiftPeriphery/Violation.swift +++ b/Sources/DangerSwiftPeriphery/Violation.swift @@ -6,6 +6,7 @@ import Foundation +/// Struct representing the violation detected by `periphery scan`. public struct Violation { public let filePath: String public let line: Int