aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/skylark
diff options
context:
space:
mode:
authorGravatar laurentlb <laurentlb@google.com>2017-11-25 06:55:54 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-25 06:58:06 -0800
commita1c73f775cb8f56914d40ec603f8489eee5110eb (patch)
tree6f49e63286e106571ddcaea3568d8d28019d6ddb /src/tools/skylark
parent6fc836bbbca1c9c2473e3bf50cc4955f23f1a79e (diff)
Improve error message for 'missing-return-value' check.
RELNOTES: None. PiperOrigin-RevId: 176899549
Diffstat (limited to 'src/tools/skylark')
-rw-r--r--src/tools/skylark/java/com/google/devtools/skylark/skylint/ControlFlowChecker.java1
-rw-r--r--src/tools/skylark/javatests/com/google/devtools/skylark/skylint/ControlFlowCheckerTest.java4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/skylark/java/com/google/devtools/skylark/skylint/ControlFlowChecker.java b/src/tools/skylark/java/com/google/devtools/skylark/skylint/ControlFlowChecker.java
index b7f94e9516..db28c52f6d 100644
--- a/src/tools/skylark/java/com/google/devtools/skylark/skylint/ControlFlowChecker.java
+++ b/src/tools/skylark/java/com/google/devtools/skylark/skylint/ControlFlowChecker.java
@@ -166,6 +166,7 @@ public class ControlFlowChecker extends SyntaxTreeVisitor {
"some but not all execution paths of '"
+ node.getIdentifier()
+ "' return a value."
+ + " If it is intentional, make it explicit using 'return None'."
+ " If you know these cannot happen,"
+ " add the statement `fail('unreachable')` to them."
+ " For more details, have a look at the documentation.",
diff --git a/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/ControlFlowCheckerTest.java b/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/ControlFlowCheckerTest.java
index 16099a7184..6d7a673acc 100644
--- a/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/ControlFlowCheckerTest.java
+++ b/src/tools/skylark/javatests/com/google/devtools/skylark/skylint/ControlFlowCheckerTest.java
@@ -53,6 +53,7 @@ public class ControlFlowCheckerTest {
.toString())
.contains(
"1:1-5:12: some but not all execution paths of 'some_function' return a value."
+ + " If it is intentional, make it explicit using 'return None'."
+ " If you know these cannot happen,"
+ " add the statement `fail('unreachable')` to them."
+ " For more details, have a look at the documentation. [missing-return-value]");
@@ -71,6 +72,7 @@ public class ControlFlowCheckerTest {
Truth.assertThat(messages)
.contains(
"1:1-5:10: some but not all execution paths of 'some_function' return a value."
+ + " If it is intentional, make it explicit using 'return None'."
+ " If you know these cannot happen,"
+ " add the statement `fail('unreachable')` to them."
+ " For more details, have a look at the documentation. [missing-return-value]");
@@ -94,6 +96,7 @@ public class ControlFlowCheckerTest {
.toString())
.contains(
"1:1-7:16: some but not all execution paths of 'f' return a value."
+ + " If it is intentional, make it explicit using 'return None'."
+ " If you know these cannot happen,"
+ " add the statement `fail('unreachable')` to them."
+ " For more details, have a look at the documentation. [missing-return-value]");
@@ -114,6 +117,7 @@ public class ControlFlowCheckerTest {
.toString())
.contains(
"1:1-8:12: some but not all execution paths of 'f' return a value."
+ + " If it is intentional, make it explicit using 'return None'."
+ " If you know these cannot happen,"
+ " add the statement `fail('unreachable')` to them."
+ " For more details, have a look at the documentation. [missing-return-value]");