From 8d32784230b72d4d49bc49fd793430cfad473b0f Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 29 Nov 2021 22:20:41 +0100 Subject: [PATCH] extend documentation on JSON (#2635) copying the information provided as answer to https://github.com/microsoft/pyright/issues/2634 --- docs/command-line.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/command-line.md b/docs/command-line.md index 27487798d..8957324bd 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -85,3 +85,7 @@ Each Diagnostic is output in the following format: ``` Diagnostic line and character numbers are zero-based. + +**Note:** Not all diagnostics have an associated diagnostic rule. For example, parse errors are emitted unconditionally and have no associated rule. Diagnostic rules are used only for diagnostics that can be disabled or enabled. + +If a rule is associated with the diagnostic, it is included in the output. If it's not, the rule field is omitted from the JSON output. If you are consuming this output, your code should be prepared to handle the case where there is no rule.