Skip to content

Allow RBS inline annotation #709

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smortex
Copy link

@smortex smortex commented Apr 5, 2025

This PR add support for RBS in-line annotations.

It replaces #656 which did that but also updated rubocop and had unrelated
changes. Rubocop was updated to a compatible version with #659, so we just
have to turn on the corresponding option of the rubocop check.

Type signature for Ruby (rbs) allow type checkers (e.g.  steep) to
statically check for issues in a code base.  Developpers must sometimes
provide hints when initializing a data structure (e.g. an empty Array)
so that the type checker can properly check its usage.  These hints are
passed with an in-line comment like so:

```
results = [] #: Array[Integer]
```

Rubocop added support for such comments as on option in its
Layout/LeadingEmptyLines check in version 1.67.0.  This gem currently
use a newer version so this option is available but not enabled yet.

Enable this option to make it possible to use both rbs and standard at
the same time.
@smortex smortex marked this pull request as ready for review April 5, 2025 20:52
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.

1 participant