Skip to content

Commit

Permalink
add expiryDate message
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiMatsumura committed Nov 19, 2024
1 parent 8546769 commit 4f5775d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ class FlagTypeExpiryDateIllegalParamDetector : Detector(), SourceCodeScanner {
}
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\""
val message =
"The value of expireDate is not in the correct date format. (expiryDate=$expiryDate)\n" +
"Please set the expiration date in the following format: \"yyyy-mm-dd\""
context.report(ISSUE_ILLEGAL_DATE, element, location, message)
}
}
Expand All @@ -65,8 +66,9 @@ class FlagTypeExpiryDateIllegalParamDetector : Detector(), SourceCodeScanner {
) {
when (qualifiedName) {
AnnotationPackagePath.PACKAGE_PATH_WIP, AnnotationPackagePath.PACKAGE_PATH_EXPERIMENT -> {
val message = "`EXPIRY_DATE_INFINITE` cannot be set for the expireDate of `@FlagType.WorkInProgress` and `@FlagType.Experiment`.\n" +
"Please set the expiration date in the following format: \"yyyy-mm-dd\""
val message =
"`EXPIRY_DATE_INFINITE` cannot be set for the expireDate of `@FlagType.WorkInProgress` and `@FlagType.Experiment`.\n" +
"Please set the expiration date in the following format: \"yyyy-mm-dd\""
context.report(ISSUE_ILLEGAL_EXPIRY_DATE_INFINITE_PARAM, element, location, message)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class FlagTypeExpiryDateIllegalParamDetectorText : LintDetectorTest() {
.run()
.expect(
"""
src/foo/Example.kt:12: Error: The value of expireDate is not in the correct date format.
src/foo/Example.kt:12: Error: The value of expireDate is not in the correct date format. (expiryDate=2023-12-100)
Please set the expiration date in the following format: "yyyy-mm-dd" [FlagfitIllegalDate]
@FlagType.Ops(
^
Expand Down

0 comments on commit 4f5775d

Please sign in to comment.