Add Danger check for Decimal(exactly: aBigUInt) which compiles but crashes at runtime

pull/1104/head
Hwee-Boon Yar 6 years ago
parent 22f73e9e7b
commit f333929899
  1. 12
      dangerfile.js

@ -7,6 +7,7 @@ if (danger.github) {
warnClosureStronglyCapturesSelf() warnClosureStronglyCapturesSelf()
failUsingNSLocalizedStringWithoutR() failUsingNSLocalizedStringWithoutR()
failIfRemoveAnyRealmSchemaMigrationBlock() failIfRemoveAnyRealmSchemaMigrationBlock()
failIfUseDecimalExactlyInit()
checkForSpacesInOtherwiseEmptyLines() checkForSpacesInOtherwiseEmptyLines()
} }
@ -54,6 +55,17 @@ function failIfRemoveAnyRealmSchemaMigrationBlock() {
}) })
} }
//Can't use Decimal(exactly: aBigUint). It compiles but crashes at runtime
function failIfUseDecimalExactlyInit() {
modifiedSwiftFiles().forEach(each => {
danger.git.diffForFile(each).then(diff => {
if (diff.added.includes("Decimal(exactly:")) {
fail(each + ": Must not use Decimal(exactly:), especially on BigUInt. Use Decimal(string: aBigUint.description) instead")
}
})
})
}
function checkForSpacesInOtherwiseEmptyLines() { function checkForSpacesInOtherwiseEmptyLines() {
modifiedSwiftFiles().forEach(each => { modifiedSwiftFiles().forEach(each => {
danger.git.diffForFile(each).then(diff => { danger.git.diffForFile(each).then(diff => {

Loading…
Cancel
Save