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

Relax strictness of annotation RBI files #171

Merged
merged 5 commits into from
Aug 2, 2023
Merged

Conversation

paracycle
Copy link
Member

Type of Change

  • Add RBI for a new gem
  • Modify RBI for an existing gem
  • Other:

Changes

I changed all the annotation files to typed: true since anything above that is useless for annotation RBI files for two reasons:

  1. There is nothing the end-user can do if the annotation RBI file has errors at the higher strictness levels. It causes confusion, and makes end-users override the strictness in their config to work around it. This is related to Replace Class with T::Class[T.anything] in lhm-shopify RBI #168
  2. As per my comment in #168, as of today, Sorbet does not error for methods missing signatures in RBI files that are at typed: strict or above. That means that we hadn't been enforcing signatures to exist until now anyway.

So the changes I've made can be read commit by commit and are:

  1. Change all annotation RBI file strictness levels to be typed: true and force it to be so for all RBI files via the rubocop check.
  2. Use the Sorbet/EnforceSignatures cop to error for any methods that don't have signatures
  3. Fix existing errors related to methods and missing signatures

Annotation RBI files don't have any need to be `typed: strict` or above, since there is nothing the end user can do to fix any strictness related errors anyway.

Moreover, as things stand right now, Sorbet does not generate static type-checking errors for missing `sig`s in files `typed: strict` or above, so there is no benefit to having them be at that strictness level.
Use `Sorbet/EnforceSignatures` cop to check for missing signatures.
@paracycle paracycle merged commit 2fc54e9 into main Aug 2, 2023
4 checks passed
@paracycle paracycle deleted the uk-relax-strictness branch August 2, 2023 19:24
@Morriar Morriar added the chore label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants