From 3e2ab1258b932863c01042d116bf40f63522eabd Mon Sep 17 00:00:00 2001 From: ericgpks Date: Mon, 28 Apr 2025 22:01:16 +0900 Subject: [PATCH 1/4] feat: add necessary gems to introduce rbs to this repository 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. --- Gemfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Gemfile b/Gemfile index 43abf00..54911d2 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,11 @@ source 'https://rubygems.org' # Specify your gem's dependencies in youplot.gemspec gemspec +group :development do + gem 'steep', require: false + gem 'typeprof' +end + group :test do gem 'rake' gem 'simplecov' From 674daa84eb9f89414b0009a3cd9835ac56c824b1 Mon Sep 17 00:00:00 2001 From: ericgpks Date: Mon, 28 Apr 2025 22:11:31 +0900 Subject: [PATCH 2/4] feat: add Steepfile with the minimum configuration 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. --- Steepfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Steepfile diff --git a/Steepfile b/Steepfile new file mode 100644 index 0000000..edee931 --- /dev/null +++ b/Steepfile @@ -0,0 +1,8 @@ +D = Steep::Diagnostic + +target :lib do + signature "sig" + check "lib" # Directory name to check + + configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting +end From 448c1e90795e6b8a9733d781cd77860c615ad2fc Mon Sep 17 00:00:00 2001 From: ericgpks Date: Mon, 28 Apr 2025 22:31:43 +0900 Subject: [PATCH 3/4] feat: add processing.rbs as a type definition file for processing.rb 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. --- sig/youplot/backends/processing.rbs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sig/youplot/backends/processing.rbs diff --git a/sig/youplot/backends/processing.rbs b/sig/youplot/backends/processing.rbs new file mode 100644 index 0000000..9830361 --- /dev/null +++ b/sig/youplot/backends/processing.rbs @@ -0,0 +1,7 @@ +module YouPlot + module Backends + module Processing + def count_values: ([], ?tally: true, ?reverse: false) -> Array[Array[untyped]] + end + end +end From 764fb977f3d117ca90d34359d84cab21d56a60f1 Mon Sep 17 00:00:00 2001 From: ericgpks Date: Wed, 30 Apr 2025 23:20:59 +0900 Subject: [PATCH 4/4] fix: add condition for using steep and typeprof to pass CI with all Ruby versions --- Gemfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 54911d2..90a7c73 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,10 @@ source 'https://rubygems.org' gemspec group :development do - gem 'steep', require: false - gem 'typeprof' + if RUBY_VERSION >= '3.0' + gem 'steep', require: false + gem 'typeprof' + end end group :test do