leinardi / mypy-pycharm

A plugin providing both real-time and on-demand scanning of Python files with Mypy from within PyCharm/IDEA.
Apache License 2.0
188 stars 30 forks source link

Mypy error message is truncated #73

Open lester-wu opened 3 years ago

lester-wu commented 3 years ago

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

Steps to reproduce:

Run Check Current File to run mypy on current mypy

Observed Results:

Screen Shot 2021-04-15 at 11 22 56 PM

Expected Results:

The error message is truncated so that I can not see the entire error message. Fox example, the complete message for the first error would be Incompatible default for argument "arg1" (default has type "int", argument has type "str") [assignment], not Incompatible default for argument "arg1"

Relevant Code:

def test(arg1: str = 1, arg2: int = "2") -> None:
    return
datalogics-kam commented 11 months ago
image

Should be

cdk_workshop/cdk_workshop_stack.py:13: error: Argument "runtime" to "Function" has incompatible type "int"; expected "Runtime"  [arg-type]
                runtime=3,
                        ^

PyCharm 2023.2.1 RC Build #PY-232.9559.11, built on August 10, 2023

intgr commented 11 months ago

I believe this happens when using the pretty = true setting in mypy configuration, which turns on word wrapping: https://mypy.readthedocs.io/en/stable/config_file.html#confval-pretty

There is an undocumented command line argument --no-pretty that the plugin could use.

Meanwhile as a workaround, remove pretty from your mypy settings.

datalogics-kam commented 11 months ago

as a workaround, remove pretty from your mypy settings.

That fixed it! Thanks for getting back to me with that information! I'm good for now.

There is an undocumented command line argument --no-pretty that the plugin could use.

That would be splendid, and it is in fact documented, from mypy --help

  --pretty                  Use visually nicer output in error messages: Use
                            soft word wrap, show source code snippets, and
                            show error location markers (inverse: --no-pretty)
intgr commented 11 months ago

it is in fact documented

Ah nice! I only checked the online docs.