Skip to content

Commit

Permalink
Merge pull request #31 from abema/hotfix-deprecated-error
Browse files Browse the repository at this point in the history
Fix bugs related to EXPIRY_DATE_NOT_DEFINED.
  • Loading branch information
momomomo111 committed Jun 27, 2023
2 parents 1ec093e + 85e5479 commit f3e2de8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class FlagTypeExpiryDateIllegalParamDetector : Detector(), SourceCodeScanner {
reportInfiniteExpiryDateErrorIfNeeded(qualifiedName, context, element, location)
return
}
if (expiryDate == FlagType.EXPIRY_DATE_NOT_DEFINED) return
if (!isDateFormatValid(expiryDate)) {
val message = "The value of expireDate is not in the correct date format.\n" +
"Please set the expiration date in the following format: \"yyyy-mm-dd\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,40 @@ class FlagTypeExpiryDateIllegalParamDetectorText : LintDetectorTest() {
.expectClean()
}

@Test
fun testDeprecatedFlagTypeNoWarning() {
lint()
.files(
stabBooleanFlag,
stabFlagType,
kotlin(
"""
package foo
import tv.abema.flagfit.FlagType
import tv.abema.flagfit.annotation.BooleanFlag
import tv.abema.flagfit.FlagType.Companion.OWNER_NOT_DEFINED
import tv.abema.flagfit.FlagType.Companion.EXPIRY_DATE_NOT_DEFINED
interface Example {
@BooleanFlag(
key = "new-awesome-feature",
defaultValue = false
)
@FlagType.Ops(
owner = OWNER_NOT_DEFINED,
expiryDate = EXPIRY_DATE_NOT_DEFINED,
)
fun awesomeOpsFeatureEnabled(): Boolean
}
""".trimIndent()
)
)
.issues(*issues.toTypedArray())
.allowMissingSdk()
.run()
.expectClean()
}

override fun getDetector(): Detector = FlagTypeExpiryDateIllegalParamDetector()

override fun getIssues(): MutableList<Issue> {
Expand Down

0 comments on commit f3e2de8

Please sign in to comment.