Skip to content

Commit 57dab8c

Browse files
committed
verbose output
1 parent 588bd2d commit 57dab8c

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

eng/tools/azure-sdk-tools/azpysdk/verifytypes.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,21 @@ def get_type_complete_score(
199199
f"Running verifytypes failed: {e.stderr}. See https://aka.ms/python/typing-guide for information."
200200
)
201201
return -1.0
202-
report = json.loads(e.output)
202+
try:
203+
report = json.loads(e.output)
204+
except (json.JSONDecodeError, TypeError):
205+
logger.error(
206+
f"pyright --verifytypes exited with code 1 but did not produce valid JSON output.\n"
207+
f"stdout: {e.output}\n"
208+
f"stderr: {e.stderr}\n"
209+
f"Re-running without --outputjson for diagnostic output..."
210+
)
211+
non_json_commands = [c for c in commands[1:] if c != "--outputjson"] + ["--verbose"]
212+
diag = self.run_venv_command(executable, non_json_commands, cwd, check=False)
213+
logger.error(f"Diagnostic pyright stdout:\n{diag.stdout}")
214+
if diag.stderr:
215+
logger.error(f"Diagnostic pyright stderr:\n{diag.stderr}")
216+
return -1.0
203217
if check_pytyped:
204218
pytyped_present = report["typeCompleteness"].get("pyTypedPath", None)
205219
if not pytyped_present:

0 commit comments

Comments
 (0)