Skip to content

[wip]Introduce rbs and add a type definition file for processing.rb first#56

Merged
kojix2 merged 6 commits into
mainfrom
feat/introduce_rbs
May 23, 2026
Merged

[wip]Introduce rbs and add a type definition file for processing.rb first#56
kojix2 merged 6 commits into
mainfrom
feat/introduce_rbs

Conversation

@ericgpks
Copy link
Copy Markdown
Contributor

No description provided.

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.
@ericgpks ericgpks changed the title Introduce rbs and add a type definition file for processing.rb first [wip]Introduce rbs and add a type definition file for processing.rb first Apr 28, 2025
@kojix2
Copy link
Copy Markdown
Member

kojix2 commented May 6, 2025

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.

@kojix2 kojix2 requested a review from Copilot May 18, 2026 11:36
@kojix2 kojix2 marked this pull request as ready for review May 18, 2026 11:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Steepfile targeting lib with signatures under sig.
  • 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: true disallows the existing tally: false call path, and ?reverse: false disallows the count command when --reverse passes true. 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.rb uses module_function and the code calls YouPlot::Backends::Processing.count_values as 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.

Comment thread sig/youplot/backends/processing.rbs Outdated
Comment thread sig/youplot/backends/processing.rbs Outdated
Comment thread Steepfile
Comment thread Steepfile
@kojix2 kojix2 merged commit fbf8801 into main May 23, 2026
24 of 32 checks passed
@kojix2
Copy link
Copy Markdown
Member

kojix2 commented May 23, 2026

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.

@kojix2
Copy link
Copy Markdown
Member

kojix2 commented May 23, 2026

Note:
I like Crystal, but I am not a strong believer in static typing.
I do not think typed code is always better than untyped code.
I just want to learn more through OSS work. Thank you.

@kojix2 kojix2 deleted the feat/introduce_rbs branch May 23, 2026 09:59
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.

3 participants