Skip to content

Commit ed9d045

Browse files
authored
Use rbs collection for validation by rbs command (#479)
In the next PR, it will define the type for the HTTP client and make slight modifications to the code. In the process, types from other libraries will be needed. This change is a preparation for that. It imports the types of the necessary external libraries using the `rbs validate` command.
1 parent c901699 commit ed9d045

5 files changed

Lines changed: 168 additions & 13 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,8 @@ jobs:
3636
- run: bundle exec rubocop
3737
- run: bundle exec rspec
3838
- run: bundle exec yard stats ./lib/line/bot/v2 --fail-on-warning
39-
40-
rbs:
41-
runs-on: ubuntu-latest
42-
permissions:
43-
contents: read
44-
steps:
45-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0
47-
with:
48-
ruby-version: '3.2'
49-
- run: gem install rbs
50-
- run: rbs -I sig validate
39+
- run: bundle exec rbs collection install
40+
- run: bundle exec rbs -I sig validate
5141

5242
pinact:
5343
runs-on: ubuntu-latest

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ source 'https://rubygems.org'
33
gemspec
44

55
gem 'multipart-post', '~> 2.4.1', require: false
6+
gem 'net-http', '~> 0.6.0', require: false
67

78
group :development, :test do
89
# ref: http://docs.rubocop.org/en/latest/installation/
910
gem 'rack', '~> 3.0'
11+
gem 'rbs', '~> 3.9.2'
1012
gem 'rubocop', '~> 1.75.0', require: false
1113
gem 'steep', '~> 1.10.0'
1214
gem 'webrick', '~> 1.9.1'

Gemfile.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ GEM
4343
json (2.10.2)
4444
language_server-protocol (3.17.0.4)
4545
lint_roller (1.1.0)
46+
logger (1.7.0)
4647
listen (3.9.0)
4748
rb-fsevent (~> 0.10, >= 0.10.3)
4849
rb-inotify (~> 0.9, >= 0.9.10)
49-
logger (1.7.0)
5050
minitest (5.25.5)
5151
multipart-post (2.4.1)
52+
net-http (0.6.0)
53+
uri
5254
mutex_m (0.3.0)
5355
parallel (1.26.3)
5456
parser (3.3.7.4)
@@ -138,8 +140,10 @@ DEPENDENCIES
138140
addressable (~> 2.3)
139141
line-bot-api!
140142
multipart-post (~> 2.4.1)
143+
net-http (~> 0.6.0)
141144
rack (~> 3.0)
142145
rake (~> 13.0)
146+
rbs (~> 3.9.2)
143147
rspec (~> 3.13.0)
144148
rubocop (~> 1.75.0)
145149
steep (~> 1.10.0)

rbs_collection.lock.yaml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
path: ".gem_rbs_collection"
3+
gems:
4+
- name: addressable
5+
version: '2.8'
6+
source:
7+
type: git
8+
name: ruby/gem_rbs_collection
9+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
10+
remote: https://github.com/ruby/gem_rbs_collection.git
11+
repo_dir: gems
12+
- name: bigdecimal
13+
version: '3.1'
14+
source:
15+
type: git
16+
name: ruby/gem_rbs_collection
17+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
18+
remote: https://github.com/ruby/gem_rbs_collection.git
19+
repo_dir: gems
20+
- name: cgi
21+
version: '0'
22+
source:
23+
type: stdlib
24+
- name: diff-lcs
25+
version: '1.5'
26+
source:
27+
type: git
28+
name: ruby/gem_rbs_collection
29+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
30+
remote: https://github.com/ruby/gem_rbs_collection.git
31+
repo_dir: gems
32+
- name: digest
33+
version: '0'
34+
source:
35+
type: stdlib
36+
- name: erb
37+
version: '0'
38+
source:
39+
type: stdlib
40+
- name: fileutils
41+
version: '0'
42+
source:
43+
type: stdlib
44+
- name: hashdiff
45+
version: '1.1'
46+
source:
47+
type: git
48+
name: ruby/gem_rbs_collection
49+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
50+
remote: https://github.com/ruby/gem_rbs_collection.git
51+
repo_dir: gems
52+
- name: logger
53+
version: '0'
54+
source:
55+
type: stdlib
56+
- name: monitor
57+
version: '0'
58+
source:
59+
type: stdlib
60+
- name: net-http
61+
version: '0'
62+
source:
63+
type: stdlib
64+
- name: net-protocol
65+
version: '0'
66+
source:
67+
type: stdlib
68+
- name: openssl
69+
version: '0'
70+
source:
71+
type: stdlib
72+
- name: optparse
73+
version: '0'
74+
source:
75+
type: stdlib
76+
- name: rack
77+
version: '2.2'
78+
source:
79+
type: git
80+
name: ruby/gem_rbs_collection
81+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
82+
remote: https://github.com/ruby/gem_rbs_collection.git
83+
repo_dir: gems
84+
- name: rake
85+
version: '13.0'
86+
source:
87+
type: git
88+
name: ruby/gem_rbs_collection
89+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
90+
remote: https://github.com/ruby/gem_rbs_collection.git
91+
repo_dir: gems
92+
- name: ripper
93+
version: '0'
94+
source:
95+
type: stdlib
96+
- name: singleton
97+
version: '0'
98+
source:
99+
type: stdlib
100+
- name: socket
101+
version: '0'
102+
source:
103+
type: stdlib
104+
- name: stringio
105+
version: '0'
106+
source:
107+
type: stdlib
108+
- name: tempfile
109+
version: '0'
110+
source:
111+
type: stdlib
112+
- name: timeout
113+
version: '0'
114+
source:
115+
type: stdlib
116+
- name: uri
117+
version: '0'
118+
source:
119+
type: stdlib
120+
- name: webmock
121+
version: '3.19'
122+
source:
123+
type: git
124+
name: ruby/gem_rbs_collection
125+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
126+
remote: https://github.com/ruby/gem_rbs_collection.git
127+
repo_dir: gems
128+
- name: webrick
129+
version: 1.9.1
130+
source:
131+
type: rubygems
132+
- name: yard
133+
version: '0.9'
134+
source:
135+
type: git
136+
name: ruby/gem_rbs_collection
137+
revision: 2813b6be44d7617d5defa2aaecdbd4540ee1c418
138+
remote: https://github.com/ruby/gem_rbs_collection.git
139+
repo_dir: gems
140+
gemfile_lock_path: Gemfile.lock

rbs_collection.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Download sources
2+
sources:
3+
- type: git
4+
name: ruby/gem_rbs_collection
5+
remote: https://github.com/ruby/gem_rbs_collection.git
6+
revision: main
7+
repo_dir: gems
8+
9+
# You can specify local directories as sources also.
10+
# - type: local
11+
# path: path/to/your/local/repository
12+
13+
# A directory to install the downloaded RBSs
14+
path: .gem_rbs_collection
15+
16+
gems:
17+
# stdlibs
18+
- name: net-http
19+
- name: uri

0 commit comments

Comments
 (0)