Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing comma in multiline configuration #14239

Open
sobolevn opened this issue Dec 3, 2022 · 0 comments
Open

Trailing comma in multiline configuration #14239

sobolevn opened this issue Dec 3, 2022 · 0 comments
Assignees
Labels
bug mypy got something wrong topic-configuration Configuration files and flags

Comments

@sobolevn
Copy link
Member

sobolevn commented Dec 3, 2022

Bug Report

Right now these two configurations are different:

[mypy]
plugins =
  mypy_django_plugin.main

And:

[mypy]
plugins =
  mypy_django_plugin.main,

The first one works correctly. The second one fails with:

» mypy server
setup.cfg:138: error: Error importing plugin "": Empty module name  [misc]
Found 1 error in 1 file (errors prevented further checking)

I think that this error message is very confusing. I've spent several minutes tring to figure out why my plugin under test is broken. Turned out I had an extra comma in the settings.

The same happens with other similar settings. This works:

[mypy]
enable_error_code =
  truthy-bool,
  redundant-expr,
  unused-awaitable,
  ignore-without-code

This raises:

[mypy]
enable_error_code =
  truthy-bool,
  redundant-expr,
  unused-awaitable,
  ignore-without-code,
» mypy server
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Invalid error code(s): 

Again, I think that this is confusing and can easily be avoided to 0 cost.

I will check pyproject.toml config files. No idea if they are also affected.

@sobolevn sobolevn added the bug mypy got something wrong label Dec 3, 2022
@sobolevn sobolevn self-assigned this Dec 3, 2022
@AlexWaygood AlexWaygood added the topic-configuration Configuration files and flags label Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-configuration Configuration files and flags
Projects
None yet
Development

No branches or pull requests

2 participants