Skip to content
Permalink
Browse files

Lazy mode message for flow status

Summary:
`flow status` reports all the known errors. This means it can
be a little tricky to use with a server that is in lazy mode, since
"No errors" really means "No errors in the subset of the graph which
lazy mode checked".

One solution is to add a message to `flow status` alerting the user that
the server is in lazy mode and linking to documentation.

This diff also adds that documentation

Reviewed By: avikchaudhuri

Differential Revision: D7047496

fbshipit-source-id: ce02b52f607e207ba2d700c82bb3cf34ab43b6e6
  • Loading branch information...
gabelevi authored and facebook-github-bot committed Feb 23, 2018
1 parent fb159ed commit 3c0a2bbd118206a0a73a1a4d18375122c4ae1955
@@ -446,6 +446,9 @@ export default suite(({
Found 1 error
The Flow server is currently in IDE lazy mode and is only checking 1/1 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('Even though test.js is closed, it is still focused'),
@@ -982,8 +985,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -997,8 +999,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -1013,6 +1014,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
).because('There are two errors now'),

@@ -1360,6 +1364,9 @@ export default suite(({
`
No errors!
The Flow server is currently in IDE lazy mode and is only checking 0/1 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('File is open but has @noflow so we should no errors'),
@@ -1688,6 +1695,9 @@ export default suite(({
Found 1 error
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('Nothing should blow up and we should see the single error'),
@@ -1719,6 +1729,9 @@ export default suite(({
`
No errors!
The Flow server is currently in IDE lazy mode and is only checking 0/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('No files are open yet'),
@@ -1751,8 +1764,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -1767,6 +1779,9 @@ export default suite(({
Found 1 error
The Flow server is currently in IDE lazy mode and is only checking 1/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because(
@@ -1820,8 +1835,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -1835,8 +1849,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -1851,6 +1864,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('Two errors: one in each file'),
@@ -1868,8 +1884,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -1884,6 +1899,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 1/3 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('Error in dependency.js disappears and we get missing module error'),
@@ -1893,8 +1911,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -1908,8 +1925,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -1924,6 +1940,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('Restoring the file takes us back to the original two errors'),
@@ -2000,8 +2019,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -2015,8 +2033,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -2030,8 +2047,7 @@ export default suite(({
Error ------------------------------------------------------------------------------------------- otherDependent.js:3:35
Cannot assign \`123\` to \`otherDependentError\` because number [1] is incompatible
with string [2].
Cannot assign \`123\` to \`otherDependentError\` because number [1] is incompatible with string [2].
otherDependent.js:3:35
3| var otherDependentError: string = 123;
@@ -2046,6 +2062,9 @@ export default suite(({
Found 3 errors
The Flow server is currently in IDE lazy mode and is only checking 3/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('Focusing on a dependency now checks its dependents'),
@@ -2096,8 +2115,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -2111,8 +2129,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -2127,6 +2144,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
),
removeFile('focused.js')
@@ -2136,8 +2156,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -2151,8 +2170,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -2167,6 +2185,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
)
.because('We should be back at our starting state'),
@@ -2217,8 +2238,7 @@ export default suite(({
`
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -2232,8 +2252,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -2248,6 +2267,9 @@ export default suite(({
Found 2 errors
The Flow server is currently in IDE lazy mode and is only checking 2/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
).because("otherDependent's errors are ignored due to lazy mode"),
flowCmd(['force-recheck', '--focus', 'dependency.js'])
@@ -2257,8 +2279,7 @@ export default suite(({
Error ----------------------------------------------------------------------------------------------- dependency.js:3:31
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`dependencyError\` because number [1] is incompatible with string [2].
dependency.js:3:31
3| var dependencyError: string = 123;
@@ -2272,8 +2293,7 @@ export default suite(({
Error -------------------------------------------------------------------------------------------------- focused.js:3:28
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with
string [2].
Cannot assign \`123\` to \`focusedError\` because number [1] is incompatible with string [2].
focused.js:3:28
3| var focusedError: string = 123;
@@ -2287,8 +2307,7 @@ export default suite(({
Error ------------------------------------------------------------------------------------------- otherDependent.js:3:35
Cannot assign \`123\` to \`otherDependentError\` because number [1] is incompatible
with string [2].
Cannot assign \`123\` to \`otherDependentError\` because number [1] is incompatible with string [2].
otherDependent.js:3:35
3| var otherDependentError: string = 123;
@@ -2303,6 +2322,9 @@ export default suite(({
Found 3 errors
The Flow server is currently in IDE lazy mode and is only checking 3/4 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
`,
).because('force-recheck --focus promotes dependency to focused, so we see the error in otherDependent'),
]).lazy('ide'),
@@ -48,6 +48,7 @@ let print_errors ~printer ~profiling ~suppressed_errors options ~errors ~warning
~strip_root
~errors
~warnings
~lazy_msg:None
()

module CheckCommand = struct
@@ -99,6 +99,7 @@ let main option_values json pretty json_version root error_flags strip_root verb
~strip_root
~errors
~warnings
~lazy_msg:None
();
(* Return a successful exit code if there were only warnings. *)
let open FlowExitStatus in
@@ -136,6 +136,7 @@ let main option_values root error_flags strip_root ignore_flag
~strip_root
~errors
~warnings
~lazy_msg:None
();
let msg =
"\nIn order to generate a shadow file there must be no type errors!"
Oops, something went wrong.

0 comments on commit 3c0a2bb

Please sign in to comment.
You can’t perform that action at this time.