Created
August 22, 2020 21:55
-
-
Save AdamMc331/23b6bb675db78a2b0fab8720c3b0f784 to your computer and use it in GitHub Desktop.
Demonstrates how to have a custom DangerFile that gets the lines of code changed excluding a certain file.
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
# If you want to include deletions, `+ git.deleted_files` | |
modifiedOrNewFiles = (git.added_files + git.modified_files) | |
diffWithoutPackageLock = modifiedOrNewFiles.select { |file| | |
file != "package-lock.json" | |
}.map { |file| | |
git.info_for_file(file) | |
}.map { |info| | |
info[:insertions] + info[:deletions] | |
}.sum() | |
warn "Please consider breaking up this PR." if diffWithoutPackageLock > 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment