Skip to content

Instantly share code, notes, and snippets.

@jgsamudio
Created May 14, 2020 22:39
Show Gist options
  • Save jgsamudio/1d3ba274f29d0f85db5800e5d0480672 to your computer and use it in GitHub Desktop.
Save jgsamudio/1d3ba274f29d0f85db5800e5d0480672 to your computer and use it in GitHub Desktop.
// 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