Created
May 14, 2020 22:39
-
-
Save jgsamudio/1d3ba274f29d0f85db5800e5d0480672 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: - Helper Functions | |
extension DangerDSL { | |
func filesWithAdditions(fileTypes: [FileType] = [.swift], excludedFiles: [File] = []) -> [String] { | |
return (git.modifiedFiles + git.createdFiles).filter { | |
guard let fileType = $0.fileType, !excludedFiles.contains($0) else { return false } | |
return fileTypes.contains(fileType) | |
} | |
} | |
/// Reads the file and returns an array of file lines. | |
/// - Parameter file: Danger swift file. | |
/// - Parameter danger: Danger dsl used to read the file. | |
/// - Parameter filterFileTypes: | |
func read(file: File, danger: DangerDSL, filterFileTypes: [FileType]? = nil) -> [String] { | |
utils.readFile(file).components(separatedBy: "\n") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment