[wip]Introduce rbs and add a type definition file for processing.rb first#56
Conversation
To add types, I would like to have help from typeprof to define rbs files for current library code that's why I added both steep and typeprof to Gemfile.
This file indicates that type definition files are placed in the `sig` directory and the actual implementation files that I want to define types for are located in the `lib` directory. Additionally, it is configured to disable type error checking so as not to raise much errors.
As a first step toward adopting rbs for this project, added type a definition for a simple method. More type definitions will be added incrementally.
processing.rb firstprocessing.rb first
|
The name "Processing" was chosen somewhat casually with the Japanese word "処理" in mind, so feel free to suggest a better name if you have one. Sometimes, people mistake it for the Processing programming language. |
There was a problem hiding this comment.
Pull request overview
This PR introduces initial RBS/Steep support for the Ruby codebase, starting with a signature for YouPlot::Backends::Processing.count_values.
Changes:
- Adds a
Steepfiletargetinglibwith signatures undersig. - Adds development dependencies for Steep and TypeProf on Ruby 3.0+.
- Adds an initial RBS definition for
processing.rb.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
Steepfile |
Adds a Steep target for checking lib against sig. |
Gemfile |
Adds Steep and TypeProf as development dependencies for Ruby 3.0+. |
sig/youplot/backends/processing.rbs |
Adds the initial RBS signature for the processing backend. |
Comments suppressed due to low confidence (2)
sig/youplot/backends/processing.rbs:4
- The keyword types are literal-only here:
?tally: truedisallows the existingtally: falsecall path, and?reverse: falsedisallows the count command when--reversepassestrue. These should be typed as booleans so Steep accepts both supported values.
def count_values: ([], ?tally: true, ?reverse: false) -> Array[Array[untyped]]
sig/youplot/backends/processing.rbs:4
- This declares only an instance method on the module, but
processing.rbusesmodule_functionand the code callsYouPlot::Backends::Processing.count_valuesas a module singleton method. As written, the public call sites will not be covered by this signature.
def count_values: ([], ?tally: true, ?reverse: false) -> Array[Array[untyped]]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Sorry for the late reply. I would like to take this opportunity to learn a little about the ecosystem of external type definition files in Ruby, and what they mean in practice. |
|
Note: |
No description provided.