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

Enable Sorbet/TrueSigil cop #15274

Merged
merged 1 commit into from Apr 20, 2023
Merged

Conversation

dduugg
Copy link
Sponsor Member

@dduugg dduugg commented Apr 19, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

As the remaining un-typed files were removed in #15201 and #15273, this PR enables a cop that requires files to be typed. The configuration is taken from Sorbet/FalseSigil above it, with the exception of excluding all Homebrew/test files.

Copy link
Member

@issyl0 issyl0 left a comment

Choose a reason for hiding this comment

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

On the "ignore tests" part, I don't know anything about the desired state of typechecking test files - is this a thing that is never going to be done, or might be when the landscape is better, or should be done now or incrementally when people get time? I wonder what would happen if we set typed: true for tests. 🤔

Library/.rubocop.yml Show resolved Hide resolved
@dduugg
Copy link
Sponsor Member Author

dduugg commented Apr 19, 2023

On the "ignore tests" part, I don't know anything about the desired state of typechecking test files - is this a thing that is never going to be done, or might be when the landscape is better, or should be done now or incrementally when people get time? I wonder what would happen if we set typed: true for tests. 🤔

I've managed to do it in a gem by introducing an rspec context that i typecheck independently of the rest of the code. I think the main issue here would bethat any test using let would fail.

@issyl0
Copy link
Member

issyl0 commented Apr 20, 2023

Ah, we use a lot of let. Good to know, though, interesting! Feel free to merge this, and thank you for your efforts to move the needle on our Sorbet adoption - this is great.

@MikeMcQuaid
Copy link
Member

I don't know anything about the desired state of typechecking test files - is this a thing that is never going to be done

IMO: it's not worth type checking these files at all and I'd favour even removing the typed: false on those files to indicate this.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks again @dduugg!

@MikeMcQuaid MikeMcQuaid merged commit 72bdefb into Homebrew:master Apr 20, 2023
24 checks passed
@dduugg dduugg deleted the enable-truesigil-cop branch April 20, 2023 18:14
@dduugg
Copy link
Sponsor Member Author

dduugg commented Apr 20, 2023

I don't know anything about the desired state of typechecking test files - is this a thing that is never going to be done

IMO: it's not worth type checking these files at all and I'd favour even removing the typed: false on those files to indicate this.

That's a reasonable stylistic choice, since typed:false is the default setting. Sorbet/FalseSigil will need to be disabled (or re-scoped), then a sed find-and-replace should clean things up. I can take, feel free to file a ticket and assign to me to confirm that's the desired outcome.

@MikeMcQuaid MikeMcQuaid mentioned this pull request Apr 21, 2023
1 task
@MikeMcQuaid
Copy link
Member

@dduugg Done: #15281

Another thing worth considering (I can make an issue again if helpful): enabling Sorbet/EnforceSignatures now that we have Sorbet/TrueSigil. I've seen some usage of typed: strict which I don't think we should (ever) use and, on my work project, Sorbet/EnforceSignatures feels like a good middle ground.

@github-actions github-actions bot added the outdated PR was locked due to age label May 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants