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

Improvements to --strict-optional[-whitelist] #2126

Closed
gvanrossum opened this issue Sep 13, 2016 · 4 comments
Closed

Improvements to --strict-optional[-whitelist] #2126

gvanrossum opened this issue Sep 13, 2016 · 4 comments

Comments

@gvanrossum
Copy link
Member

gvanrossum commented Sep 13, 2016

I'd like to make two changes to --strict-optional-whitelist (abbreviated to --sow below):

  • Make multiple occurrences of the flag be cumulatively, so that --sow A --sow B is equivalent to --SOW A B. The motivation for this is to let us put this flag in a script that runs mypy while allowing the script to take additional --sow flags and pass them through.
  • Include the flag in the "options" field in the incremental meta json file, so that runs with different settings don't reuse the cache. In fact the json file should probably have three possible values: strict optional off, strict optional on, and strict optional on but excluding this file. (The reason is that the behavior of "strict optional off" really is different from "strict optional on but not in this file".) [UPDATE: This has been implemented]
  • A possible third change would be to disallow the form --sow A B C, requiring --sow A --sow B --sow C instead. There are some edge cases to the current behavior that are confusing, e.g. you can't have --sow A immediately followed by the list of files to check.
@JukkaL
Copy link
Collaborator

JukkaL commented Sep 13, 2016

One option is to require a delimiter when providing multiple values with a single --sow argument, for example --sow A,B,C.

@gvanrossum
Copy link
Member Author

Note that people are already using the existing whitelist syntax so I'd like to tread carefully.

@gvanrossum gvanrossum changed the title Improvements to --strict-optional-whitelist Improvements to --strict-optional[-whitelist] Sep 15, 2016
gvanrossum pushed a commit that referenced this issue Sep 17, 2016
This fixes the second bullet of #2126 but not the others.  It depends
on the changes in this branch (in master options.strict_optional does
not exist).
@gvanrossum
Copy link
Member Author

@ddfisher Thoughts? Maybe we can retire/deprecate --strict-optional-whitelist in favor of using per-file sections in mypy.ini? E.g.

[mypy]
show_none_errors = True  # same as default
[mypy-foo/*]
show_none_errors = True  # redundant
[mypy-bar/*]
show_none_errors = False

This would not change the behavior of runs without --strict-optional, but for runs with --strict-optional it would suppress the "none" errors in the bar directory.

@ddfisher
Copy link
Collaborator

Obsoleted by #3206.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants