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

Revisit disabled-by-default errors #86

Closed
JelleZijlstra opened this issue Jan 16, 2022 · 1 comment · Fixed by #101
Closed

Revisit disabled-by-default errors #86

JelleZijlstra opened this issue Jan 16, 2022 · 1 comment · Fixed by #101

Comments

@JelleZijlstra
Copy link
Collaborator

I'd like to get rid of the disabled-by-default Y090, Y091, and Y092. This will require a couple of different changes both in typeshed and here, so I'm opening this issue to track them all.

  1. Y090 and Y091
    These are essentially special cases of Y010 (don't put stuff in a function body) that we disabled for compatibility years ago. There are no remaining triggers for these rules in typeshed, so I propose that we get rid of the separate codes and make Y010 trigger on everything you may put in a function body.

  2. Y092 triggers on a lot of existing typeshed code:

stdlib/typing_extensions.pyi:43:26: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:44:23: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:45:22: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:46:26: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:47:29: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:51:25: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:78:21: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:92:27: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:93:24: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:128:33: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:129:31: Y092 Top-level attribute must not have a default value
stdlib/typing_extensions.pyi:130:31: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:49:23: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:50:26: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:51:23: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:52:25: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:54:26: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:55:26: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:56:22: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:57:26: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:58:26: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:60:27: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:62:29: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:90:33: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:91:31: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:92:31: Y092 Top-level attribute must not have a default value
stdlib/typing.pyi:136:31: Y092 Top-level attribute must not have a default value
stdlib/@python2/asyncore.pyi:9:24: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:37:26: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:38:23: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:42:25: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:62:21: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:73:27: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:74:24: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:103:29: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:104:27: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing_extensions.pyi:105:27: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:25:23: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:26:26: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:27:23: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:28:25: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:29:26: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:30:26: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:31:22: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:32:26: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:33:23: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:39:25: Y092 Top-level attribute must not have a default value
stdlib/@python2/typing.pyi:41:21: Y092 Top-level attribute must not have a default value
stdlib/@python2/bdb.pyi:8:38: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:4:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:5:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:7:20: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:8:23: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:9:20: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:11:13: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:13:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:14:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:15:17: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:16:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:17:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:18:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:19:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:20:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:21:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:22:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:23:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:24:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:25:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:26:14: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:27:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:28:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:29:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:30:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:31:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:32:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:33:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:34:17: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:35:17: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:36:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:37:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:38:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:39:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:40:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:41:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:42:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:43:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:44:15: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:45:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:46:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:47:18: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:48:17: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:49:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:50:16: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:53:21: Y092 Top-level attribute must not have a default value
stdlib/@python2/signal.pyi:54:25: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:26:20: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:27:19: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:28:21: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:54:29: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:56:37: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:57:37: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:58:31: Y092 Top-level attribute must not have a default value
stdlib/@python2/ctypes/__init__.pyi:59:20: Y092 Top-level attribute must not have a default value
stdlib/@python2/dbm/ndbm.pyi:10:16: Y092 Top-level attribute must not have a default value
stubs/paramiko/paramiko/pkey.pyi:6:29: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:4:25: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:5:23: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:6:23: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:7:23: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:8:22: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:9:23: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:10:30: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:12:31: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:13:29: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:14:21: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:15:22: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:16:30: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:17:27: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:18:21: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:19:22: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:20:20: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:21:22: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:22:23: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:23:22: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:24:24: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:25:26: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:27:25: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:28:32: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:29:40: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:30:37: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:31:35: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:32:31: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:33:29: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:34:42: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:35:40: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:36:36: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:37:30: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:38:32: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:39:30: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:40:30: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:41:26: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:42:31: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:43:35: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:44:55: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:45:33: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:46:36: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:47:33: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:48:35: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:49:33: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:50:32: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:51:47: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:52:46: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:53:50: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:54:48: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:55:43: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:57:26: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:58:26: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:59:23: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:61:32: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:62:31: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:63:33: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:64:32: Y092 Top-level attribute must not have a default value
stubs/pyaudio/pyaudio.pyi:65:31: Y092 Top-level attribute must not have a default value
stubs/cryptography/cryptography/x509/oid.pyi:102:43: Y092 Top-level attribute must not have a default value
stubs/cryptography/cryptography/x509/oid.pyi:104:67: Y092 Top-level attribute must not have a default value
stubs/setuptools/pkg_resources/__init__.pyi:41:27: Y092 Top-level attribute must not have a default value

These are mostly of the form constant: type = ..., and they seem legitimate to me. I'll send a PR to typeshed to get rid of the = .... After that we can consider turning it on by default.

JelleZijlstra added a commit that referenced this issue Jan 16, 2022
JelleZijlstra added a commit to JelleZijlstra/typeshed that referenced this issue Jan 16, 2022
JelleZijlstra added a commit that referenced this issue Jan 16, 2022
@JelleZijlstra
Copy link
Collaborator Author

Y090 and 91 are gone now.

Y092 has significant false positives and limited upside (python/typeshed#6930), so I'm proposing to remove it in #88.

That leaves only Y093, about using TypeAlias. I suggest we simply turn that on by default now and turn it off in typeshed until all type checkers support it. That way, we can get rid of the fragile handling for disabled-by-default errors in this plugin.

JelleZijlstra added a commit that referenced this issue Jan 19, 2022
And delete the machinery for disabling errors.

This made this check run on all tests, which helped me find a bug
(it triggered on __all__). I can split the test changes into a separate
PR if preferred.

I'll submit a separate PR to typeshed to disable this check for now.

Fixes #75. Fixes #86.
AlexWaygood pushed a commit that referenced this issue Jan 19, 2022
Enable TypeAlias check by default, and delete the machinery for disabling errors.

Fixes #75. Fixes #86.
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 a pull request may close this issue.

1 participant