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 diff --git a/sig/_private/internal.rbs b/sig/_private/internal.rbs new file mode 100644 index 0000000..2be1140 --- /dev/null +++ b/sig/_private/internal.rbs @@ -0,0 +1,7 @@ +# 存在しないmoduleを定義したくないのでトップレベルのtypeを許可 +# rubocop:disable RBS/Lint/TopLevelTypeAlias + +type pin = Integer | String +type id = Integer | String + +# rubocop:enable all 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/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,