How to get fileDiff from danger-swift?
I see that danger-js can get the the diffs for git here https://github.com/danger/danger-js/blob/8f55336f0c0c5443d29cc0d886123c365e5f225b/source/dsl/GitDSL.ts But I don't know if it is available in danger-swift. Or anyone knows how to get the file diffs with danger-swift?
This would need to be re-implemented in Swift I'm afraid, the same data is available - so it could be a matter of copy&pasting then making syntax work
Is there a chance this was addressed / there is a plan to address this? I am hoping to have Danger set a limit for how many insertions and deletions a PR can be, but I want this limit to exclude some file types (.xib files for example).
This would need to be re-implemented in Swift I'm afraid, the same data is available - so it could be a matter of copy&pasting then making syntax work
@orta could you point me out which file should be re written to support the diffs? So that I can work on that.
I’m not sure anymore been a few years since I looked, you take the incoming JSON and and do work with that. The codebase is small, you can find it
I made a little helper which might help anyone else looking into getting line diff counts with excluded files, as I couldn't see anything natively in danger-swift: https://gist.github.com/ceeK/1e9623b2e86478bd68ad12082a5b1a35
Callsite:
let excludedFiles = [
".generated.swift",
]
let diff = ExcludedDiff.diff(withExcludedFiles: excludedFiles, sourceBranch: "origin/master")
// diff.totalAdditions
// diff.totalDeletions
Luckily the file diff function was added towards the end of 2020 :)