Skip to content

Commit

Permalink
Fix <description> being removed from checker failure errors (#169)
Browse files Browse the repository at this point in the history
* Fixes issue where markdown on Github is dropping <description>

* Update tests
  • Loading branch information
maallen authored Oct 23, 2024
1 parent 5a651cc commit e54ee55
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 26 deletions.
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

0 comments on commit e54ee55

Please sign in to comment.