Skip to content

Support flexible option specification in config file and inline configuration #7054

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

Merged
merged 3 commits into from
Jun 24, 2019

Conversation

msullivan
Copy link
Collaborator

Support inverting options based on no_, and adding or removing a dis prefix
in the config file (and therefore in inline configuration also).

This moves the handling of no_ prefixes from inline configuration to the config file.
As a result, the config file is brought closer into alignment with the command line options.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

elif callable(ct):
if invert:
print("%sCan not invert non-boolean key %s" % (prefix, options_key), file=stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this kind of errors be sys.exit(2)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Probably
  2. Similar errors are not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gvanrossum What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the mypy.ini file was new, I decided to make errors in the config file just print warnings. I can't recall why, possibly because the control flow to make them real errors was complex, or possibly because I was worried that people would have junk in their config files.

I'd stick to this tradition for now and do a separate sweep to clean it up later. (Maybe sections we don't recognize should not be fatal but in recognized sections, flags we don't understand should be fatal?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd stick to this tradition for now and do a separate sweep to clean it up later.

SGTM.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will invalidate some people's mypy.ini files, right? So it should be messaged carefully with the next release.

@msullivan
Copy link
Collaborator Author

This will invalidate some people's mypy.ini files, right? So it should be messaged carefully with the next release.

I don't think it really will? Certain configurations that currently produce a warning will instead have meaning, but I don't think that counts.

@msullivan msullivan merged commit 46aa00d into master Jun 24, 2019
@msullivan msullivan deleted the allow-disallow branch June 24, 2019 20:17
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

Successfully merging this pull request may close these issues.

3 participants