Skip to content

Commit

Permalink
Add quotes to "Tip" (bazelbuild#16570)
Browse files Browse the repository at this point in the history
Add double quotes to the tip so that it can be copied and pasted and work from a shell. Just an ease of use thing.

PiperOrigin-RevId: 483980588
Change-Id: If5f87cb52d7d20da2ab8423800c68ea7b332a5fd

Co-authored-by: Googler <dmaclach@google.com>
Co-authored-by: kshyanashree <109167932+kshyanashree@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 26, 2022
1 parent 4e207fb commit b88779e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ private String getAlternateTargetSuggestion(String targetName) {
suggestedTarget == null ? null : String.format("did you mean '%s'?", suggestedTarget);
String blazeQuerySuggestion =
String.format(
"Tip: use `query %s:*` to see all the targets in that package",
"Tip: use `query \"%s:*\"` to see all the targets in that package",
packageIdentifier.getDisplayForm(mainRepositoryMapping));
return String.format(
" (%s)", Joiner.on(" ").skipNulls().join(targetSuggestion, blazeQuerySuggestion));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ public void testHelpfulErrorForWrongPackageLabels() throws Exception {
assertThat(result.hasError()).isTrue();
assertContainsEvent(
"no such target '//x:z': target 'z' not declared in package 'x' defined by"
+ " /workspace/x/BUILD (Tip: use `query //x:*` to see all the targets in that package)"
+ " and referenced by '//y:y'");
+ " /workspace/x/BUILD (Tip: use `query \"//x:*\"` to see all the targets in that"
+ " package) and referenced by '//y:y'");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testFileThatsNotRegisteredYieldsUnknownTargetException() throws Exce
.isEqualTo(
"no such target '//pkg:baz.txt': target 'baz.txt' not declared in package 'pkg' "
+ "defined by /workspace/pkg/BUILD (did you mean 'bar.txt'? Tip: use `query "
+ "//pkg:*` to see all the targets in that package)");
+ "\"//pkg:*\"` to see all the targets in that package)");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ public void testCreationOfInputFiles() throws Exception {
.hasMessageThat()
.isEqualTo(
"no such target '//foo:A': target 'A' not declared in package 'foo' defined by"
+ " /workspace/foo/BUILD (Tip: use `query //foo:*` to see all the targets in that"
+ " package)");
+ " /workspace/foo/BUILD (Tip: use `query \"//foo:*\"` to see all the targets in"
+ " that package)");

// These are the only input files: BUILD, Z
Set<String> inputFiles = Sets.newTreeSet();
Expand Down Expand Up @@ -423,8 +423,8 @@ public void testHelpfulErrorForMissingExportsFiles() throws Exception {
.hasMessageThat()
.isEqualTo(
"no such target '//x:z.cc': target 'z.cc' not declared in package 'x' defined by"
+ " /workspace/x/BUILD (did you mean 'x.cc'? Tip: use `query //x:*` to see all the"
+ " targets in that package)");
+ " /workspace/x/BUILD (did you mean 'x.cc'? Tip: use `query \"//x:*\"` to see all"
+ " the targets in that package)");

e = assertThrows(NoSuchTargetException.class, () -> pkg.getTarget("dir"));
assertThat(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void testCompileOneDepOnMissingFile() throws Exception {
.hasMessageThat()
.isEqualTo(
"no such target '//foo:missing.cc': target 'missing.cc' not declared in package "
+ "'foo' defined by /workspace/foo/BUILD (Tip: use `query //foo:*` to see all the "
+ "targets in that package)");
+ "'foo' defined by /workspace/foo/BUILD (Tip: use `query \"//foo:*\"` to see all "
+ "the targets in that package)");

// Also, try a valid input file which has no dependent rules in its package.
e = assertThrows(TargetParsingException.class, () -> parseCompileOneDep("//foo:baz/bang"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void testGetNonexistentTarget() throws Exception {
.isEqualTo(
"no such target '//pkg1:not-there': target 'not-there' "
+ "not declared in package 'pkg1' defined by /workspace/pkg1/BUILD (Tip: use "
+ "`query //pkg1:*` to see all the targets in that package)");
+ "`query \"//pkg1:*\"` to see all the targets in that package)");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ protected final void checkResultOfTargetLiteralWithMissingTargets(
"no such target '//a:b': target 'b' not declared in package 'a' "
+ "defined by "
+ helper.getRootDirectory().getPathString()
+ "/a/BUILD (Tip: use `query //a:*` to see all the targets in that package)");
+ "/a/BUILD (Tip: use `query \"//a:*\"` to see all the targets in that package)");
assertThat(failureDetail.getPackageLoading().getCode())
.isEqualTo(FailureDetails.PackageLoading.Code.TARGET_MISSING);
}
Expand Down

0 comments on commit b88779e

Please sign in to comment.