Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs related to EXPIRY_DATE_NOT_DEFINED #31

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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