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 <description> being removed from checker failure errors #169

Merged
merged 2 commits into from
Oct 23, 2024
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 @@ -20,17 +20,21 @@ public Optional<String> getFailureText(String placeholder) {
+ placeholder
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form "
+ QUOTE_MARKER
+ placeholder
+ ":<description>";
+ ":<description>"
+ QUOTE_MARKER;
} else if (!placeholder.trim().isEmpty()) {
failureText =
"Missing description for placeholder with name "
+ QUOTE_MARKER
+ placeholder
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form "
+ QUOTE_MARKER
+ placeholder
+ ":<description>";
+ ":<description>"
+ QUOTE_MARKER;
}
return Optional.ofNullable(failureText);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testMissingPlaceholderDescriptionInComment() {
+ QUOTE_MARKER
+ "placeholder"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form placeholder:<description>"));
+ " in comment. Please add a description in the string comment in the form `placeholder:<description>`"));
}

@Test
Expand All @@ -52,15 +52,15 @@ public void testNullComment() {
+ QUOTE_MARKER
+ "placeholder"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form placeholder:<description>"));
+ " in comment. Please add a description in the string comment in the form `placeholder:<description>`"));
}

@Test
public void testMultiplePlaceholderDescriptionsInComment() {
Set<String> failures =
doubleBracesPlaceholderCommentChecker.checkCommentForDescriptions(
"A source string with a single {{placeholder}} and {another} and so {more}.",
"Test comment placeholder:description 1,another: description 2,more: description 3");
"Test comment `placeholder:description 1`,`another: description 2`,`more: description 3`");
Assert.assertTrue(failures.isEmpty());
}

Expand All @@ -77,7 +77,7 @@ public void testOneOfMultiplePlaceholderDescriptionsMissingInComment() {
+ QUOTE_MARKER
+ "another"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form another:<description>"));
+ " in comment. Please add a description in the string comment in the form `another:<description>`"));
}

@Test
Expand All @@ -93,7 +93,7 @@ public void testPluralPlaceholderMissingDescription() {
+ QUOTE_MARKER
+ "numFiles"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form numFiles:<description>"));
+ " in comment. Please add a description in the string comment in the form `numFiles:<description>`"));
}

@Test
Expand All @@ -109,6 +109,6 @@ public void testNumberedPlaceholder() {
+ QUOTE_MARKER
+ "0"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form 0:<description>"));
+ " in comment. Please add a description in the string comment in the form `0:<description>`"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void testOneOfMultiplePlaceholderDescriptionsMissingInComment() {
+ QUOTE_MARKER
+ "another"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form another:<description>",
+ " in comment. Please add a description in the string comment in the form `another:<description>`",
result.getNotificationText());
}

Expand Down Expand Up @@ -270,17 +270,17 @@ public void testMultipleIOSPlaceholderTypesFails() {
result
.getNotificationText()
.contains(
"Please add a description in the string comment in the form %1$@:<description>"));
"Please add a description in the string comment in the form `%1$@:<description>`"));
Assert.assertTrue(
result
.getNotificationText()
.contains(
"Please add a description in the string comment in the form %@:<description>"));
"Please add a description in the string comment in the form `%@:<description>`"));
Assert.assertTrue(
result
.getNotificationText()
.contains(
"Please add a description in the string comment in the form %2$@ld:<description>"));
"Please add a description in the string comment in the form `%2$@ld:<description>`"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void testFailure() {
+ QUOTE_MARKER
+ "count"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form count:<description>"));
+ " in comment. Please add a description in the string comment in the form `count:<description>`"));
}

@Test
Expand All @@ -69,7 +69,7 @@ public void testFailureWithBraces() {
+ QUOTE_MARKER
+ "count"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form count:<description>"));
+ " in comment. Please add a description in the string comment in the form `count:<description>`"));
}

@Test
Expand All @@ -86,7 +86,7 @@ public void testNullComment() {
+ QUOTE_MARKER
+ "count"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form count:<description>"));
+ " in comment. Please add a description in the string comment in the form `count:<description>`"));
}

@Test
Expand All @@ -103,7 +103,7 @@ public void testFailureWithMultiplePlaceholders() {
+ QUOTE_MARKER
+ "shelf_count"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form shelf_count:<description>"));
+ " in comment. Please add a description in the string comment in the form `shelf_count:<description>`"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testFailure() {
+ QUOTE_MARKER
+ "%1"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form %1:<description>"));
+ " in comment. Please add a description in the string comment in the form `%1:<description>`"));
}

@Test
Expand All @@ -58,7 +58,7 @@ public void testNullComment() {
+ QUOTE_MARKER
+ "%1"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form %1:<description>"));
+ " in comment. Please add a description in the string comment in the form `%1:<description>`"));
}

@Test
Expand All @@ -74,7 +74,7 @@ public void testFailureWithMultiplePlaceholders() {
+ QUOTE_MARKER
+ "%2"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form %2:<description>"));
+ " in comment. Please add a description in the string comment in the form `%2:<description>`"));
}

@Test
Expand Down Expand Up @@ -103,7 +103,7 @@ public void testNoSpecifierRegexFailure() {
+ QUOTE_MARKER
+ "%d"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form %d:<description>"));
+ " in comment. Please add a description in the string comment in the form `%d:<description>`"));
}

@Test
Expand All @@ -121,6 +121,6 @@ public void testNoSpecifierRegexFailureWithMultiplePlaceholders() {
+ QUOTE_MARKER
+ "%s"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form %s:<description>"));
+ " in comment. Please add a description in the string comment in the form `%s:<description>`"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testMissingPlaceholderDescriptionInComment() {
+ QUOTE_MARKER
+ "placeholder"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form placeholder:<description>"));
+ " in comment. Please add a description in the string comment in the form `placeholder:<description>`"));
}

@Test
Expand All @@ -52,7 +52,7 @@ public void testNullComment() {
+ QUOTE_MARKER
+ "placeholder"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form placeholder:<description>"));
+ " in comment. Please add a description in the string comment in the form `placeholder:<description>`"));
}

@Test
Expand All @@ -77,7 +77,7 @@ public void testOneOfMultiplePlaceholderDescriptionsMissingInComment() {
+ QUOTE_MARKER
+ "another"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form another:<description>"));
+ " in comment. Please add a description in the string comment in the form `another:<description>`"));
}

@Test
Expand All @@ -93,7 +93,7 @@ public void testPluralPlaceholderMissingDescription() {
+ QUOTE_MARKER
+ "numFiles"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form numFiles:<description>"));
+ " in comment. Please add a description in the string comment in the form `numFiles:<description>`"));
}

@Test
Expand All @@ -110,7 +110,7 @@ public void testNumberedPlaceholder() {
+ QUOTE_MARKER
+ "0"
+ QUOTE_MARKER
+ " in comment. Please add a description in the string comment in the form 0:<description>"));
+ " in comment. Please add a description in the string comment in the form `0:<description>`"));
}

@Test
Expand Down