From c3c8b68c307b464b302cd9a7a5cfd117dd8c3882 Mon Sep 17 00:00:00 2001 From: tufusa Date: Fri, 9 Jan 2026 14:14:58 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20pin=E3=81=A8id=E3=82=92`Integer=20|?= =?UTF-8?q?=20String`=E3=81=A8=E3=81=97=E3=81=A6=E5=85=B1=E9=80=9A?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sig/adc.rbs | 2 -- sig/gpio.rbs | 2 -- sig/i2c.rbs | 6 +++--- sig/internal/internal.rbs | 2 ++ sig/pwm.rbs | 2 -- sig/spi.rbs | 4 ++-- sig/uart.rbs | 3 --- 7 files changed, 7 insertions(+), 14 deletions(-) create mode 100644 sig/internal/internal.rbs diff --git a/sig/adc.rbs b/sig/adc.rbs index b4de83b..a025833 100644 --- a/sig/adc.rbs +++ b/sig/adc.rbs @@ -1,6 +1,4 @@ class ADC - type pin = Integer | String - def initialize: (pin pin, *untyped params) -> void def read_voltage: () -> Float diff --git a/sig/gpio.rbs b/sig/gpio.rbs index f0f5f91..94bf3bf 100644 --- a/sig/gpio.rbs +++ b/sig/gpio.rbs @@ -23,8 +23,6 @@ class GPIO # オープンドレインモードに設定する OPEN_DRAIN: _Mode - type pin = Integer | String - # @param pin 使用する物理ピン\ # @param params モードの指定\ # @example diff --git a/sig/i2c.rbs b/sig/i2c.rbs index 3bbac8b..8d782a2 100644 --- a/sig/i2c.rbs +++ b/sig/i2c.rbs @@ -1,10 +1,10 @@ class I2C def initialize: ( - ?Integer? id, + ?id? id, ?frequency: Integer, ?freq: Integer, - ?scl_pin: Integer, - ?sda_pin: Integer + ?scl_pin: pin, + ?sda_pin: pin ) -> void def read: (Integer i2c_adrs_7, Integer read_bytes, *(Integer | Array[Integer] | String) params) -> String diff --git a/sig/internal/internal.rbs b/sig/internal/internal.rbs new file mode 100644 index 0000000..db9b7b0 --- /dev/null +++ b/sig/internal/internal.rbs @@ -0,0 +1,2 @@ +type pin = Integer | String +type id = Integer | String diff --git a/sig/pwm.rbs b/sig/pwm.rbs index 155e76d..2413159 100644 --- a/sig/pwm.rbs +++ b/sig/pwm.rbs @@ -1,6 +1,4 @@ class PWM - type pin = Integer | String - def initialize: ( pin pin, ?frequency: Integer | Float, diff --git a/sig/spi.rbs b/sig/spi.rbs index 6809189..5df27df 100644 --- a/sig/spi.rbs +++ b/sig/spi.rbs @@ -11,8 +11,8 @@ class SPI type mode = 0 | 1 | 2 | 3 def initialize: ( - ?Integer? id, - ?unit: Integer, + ?id? id, + ?unit: id, ?frequency: Integer, ?mode: mode, ?first_bit: first_bit diff --git a/sig/uart.rbs b/sig/uart.rbs index eeb6bb1..928b854 100644 --- a/sig/uart.rbs +++ b/sig/uart.rbs @@ -11,9 +11,6 @@ class UART RTSCTS: parameter - type id = Integer | String - type pin = Integer | String - def initialize: ( ?id? id, ?baudrate: Integer, From 2131c305784a53dbb2a9eeb666f8599f8a904d8a Mon Sep 17 00:00:00 2001 From: tufusa Date: Fri, 9 Jan 2026 15:04:29 +0900 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20`internal.rbs`=E3=82=92`=5Fprivate?= =?UTF-8?q?/`=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sig/{internal => _private}/internal.rbs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sig/{internal => _private}/internal.rbs (100%) diff --git a/sig/internal/internal.rbs b/sig/_private/internal.rbs similarity index 100% rename from sig/internal/internal.rbs rename to sig/_private/internal.rbs From 52d85209e2b2050711f7b293898fd92ba8eecf16 Mon Sep 17 00:00:00 2001 From: tufusa Date: Fri, 9 Jan 2026 15:05:53 +0900 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20`RBS/Lint/TopLevelTypeAlias`=20?= =?UTF-8?q?=E3=82=92=E7=84=A1=E5=8A=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sig/_private/internal.rbs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sig/_private/internal.rbs b/sig/_private/internal.rbs index db9b7b0..2be1140 100644 --- a/sig/_private/internal.rbs +++ b/sig/_private/internal.rbs @@ -1,2 +1,7 @@ +# 存在しないmoduleを定義したくないのでトップレベルのtypeを許可 +# rubocop:disable RBS/Lint/TopLevelTypeAlias + type pin = Integer | String type id = Integer | String + +# rubocop:enable all From e65a075fdf743a3b3402cd1b0ab1badf095e926b Mon Sep 17 00:00:00 2001 From: tufusa Date: Fri, 9 Jan 2026 15:06:58 +0900 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20`.rbs`=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E6=89=8B=E5=8B=95=E3=81=A7=20exclude=20?= =?UTF-8?q?=E3=81=AA=E3=81=9C=E3=81=8B`.rb`=E3=81=AB=E5=AF=BE=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=83=AB=E3=83=BC=E3=83=AB=E3=81=8C=E5=8B=95=E4=BD=9C?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 2f7db8d..d4afbe6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,14 @@ plugins: AllCops: NewCops: enable +# rubocop needs manual exclude each rule; why??? +Style/Documentation: + Exclude: + - "**/*.rbs" +Style/FrozenStringLiteralComment: + Exclude: + - "**/*.rbs" + Style/StringLiterals: Enabled: true EnforcedStyle: single_quotes