Skip to content

Commit

Permalink
add comment for public interface
Browse files Browse the repository at this point in the history
  • Loading branch information
taji-taji committed Sep 12, 2022
1 parent 2fec855 commit 0fd36b8
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Sources/DangerSwiftPeriphery/DangerPeriphery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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],
Expand All @@ -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] = [],
Expand Down
1 change: 1 addition & 0 deletions Sources/DangerSwiftPeriphery/PeripheryArguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import Foundation

/// periphery scan command options
public enum PeripheryArguments {
case config(String)
case workspace(String)
Expand Down
1 change: 1 addition & 0 deletions Sources/DangerSwiftPeriphery/Violation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0fd36b8

Please sign in to comment.