jsonrpc-middleware 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.aiignore +6 -1
- data/.claude/agents/entire-search.md +25 -0
- data/.claude/agents/rbs-specialist.md +89 -0
- data/.claude/settings.json +84 -0
- data/.devcontainer/devcontainer.json +17 -0
- data/.dockerignore +16 -0
- data/.entire/.gitignore +5 -0
- data/.entire/settings.json +4 -0
- data/.rubocop.yml +26 -1
- data/.tool-versions +1 -1
- data/.yard-lint.yml +283 -0
- data/AGENTS.md +142 -0
- data/CHANGELOG.md +43 -0
- data/CLAUDE.md +2 -113
- data/Dockerfile +144 -0
- data/README.md +10 -17
- data/Rakefile +78 -26
- data/examples/README.md +9 -0
- data/examples/procedures.rb +3 -1
- data/examples/rack/Gemfile.lock +11 -2
- data/examples/rack-echo/Gemfile.lock +11 -2
- data/examples/rails/Gemfile.lock +18 -23
- data/examples/rails/config/initializers/jsonrpc.rb +1 -1
- data/examples/rails-routing-dsl/config.ru +5 -5
- data/examples/rails-single-file/config.ru +1 -1
- data/examples/rails-single-file-routing/README.md +38 -3
- data/examples/rails-single-file-routing/config.ru +18 -1
- data/examples/sinatra-classic/Gemfile.lock +11 -3
- data/examples/sinatra-modular/Gemfile.lock +11 -3
- data/lib/jsonrpc/batch_request.rb +9 -12
- data/lib/jsonrpc/batch_response.rb +7 -9
- data/lib/jsonrpc/configuration.rb +43 -4
- data/lib/jsonrpc/error.rb +8 -9
- data/lib/jsonrpc/errors/internal_error.rb +2 -0
- data/lib/jsonrpc/errors/invalid_params_error.rb +2 -0
- data/lib/jsonrpc/errors/invalid_request_error.rb +2 -0
- data/lib/jsonrpc/errors/method_not_found_error.rb +2 -0
- data/lib/jsonrpc/errors/parse_error.rb +2 -0
- data/lib/jsonrpc/helpers.rb +6 -0
- data/lib/jsonrpc/middleware.rb +15 -13
- data/lib/jsonrpc/notification.rb +8 -9
- data/lib/jsonrpc/parser.rb +22 -19
- data/lib/jsonrpc/railtie/batch_constraint.rb +1 -0
- data/lib/jsonrpc/railtie/mapper_extension.rb +2 -2
- data/lib/jsonrpc/railtie/method_constraint.rb +9 -0
- data/lib/jsonrpc/railtie/routes_dsl.rb +10 -15
- data/lib/jsonrpc/railtie.rb +4 -2
- data/lib/jsonrpc/request.rb +12 -84
- data/lib/jsonrpc/response.rb +11 -60
- data/lib/jsonrpc/types.rb +13 -0
- data/lib/jsonrpc/validator.rb +14 -4
- data/lib/jsonrpc/version.rb +1 -1
- data/lib/jsonrpc.rb +5 -0
- data/rbs_collection.lock.yaml +476 -0
- data/rbs_collection.yaml +21 -0
- data/sig/jsonrpc/batch_request.rbs +17 -0
- data/sig/jsonrpc/batch_response.rbs +17 -0
- data/sig/jsonrpc/configuration.rbs +18 -0
- data/sig/jsonrpc/error.rbs +17 -0
- data/sig/jsonrpc/errors/internal_error.rbs +5 -0
- data/sig/jsonrpc/errors/invalid_params_error.rbs +5 -0
- data/sig/jsonrpc/errors/invalid_request_error.rbs +5 -0
- data/sig/jsonrpc/errors/method_not_found_error.rbs +5 -0
- data/sig/jsonrpc/errors/parse_error.rbs +5 -0
- data/sig/jsonrpc/middleware.rbs +20 -3
- data/sig/jsonrpc/notification.rbs +15 -0
- data/sig/jsonrpc/parser.rbs +7 -1
- data/sig/jsonrpc/request.rbs +18 -0
- data/sig/jsonrpc/response.rbs +19 -0
- data/sig/jsonrpc/validator.rbs +8 -0
- data/sig/jsonrpc.rbs +3 -156
- data/sig/multi_json.rbs +17 -0
- data/sig/type_definitions.rbs +11 -0
- data/sig/zeitwerk.rbs +10 -0
- metadata +61 -9
- data/.claude/commands/document.md +0 -105
- data/.claude/commands/test.md +0 -561
- data/.claude/docs/yard.md +0 -602
- data/.claude/settings.local.json +0 -11
- data/.yardstick.yml +0 -22
data/sig/jsonrpc.rbs
CHANGED
|
@@ -1,164 +1,11 @@
|
|
|
1
1
|
module JSONRPC
|
|
2
|
-
VERSION: String
|
|
3
|
-
|
|
4
|
-
# Method definitions that should be available
|
|
5
|
-
interface _ToJson
|
|
6
|
-
def to_json: (*untyped) -> String
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
interface _HashLike
|
|
10
|
-
def []: (Symbol) -> untyped
|
|
11
|
-
def []=: (Symbol, untyped) -> untyped
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Representing JSON-compatible types
|
|
15
|
-
type json_scalar = String | Integer | Float | bool | nil
|
|
16
|
-
type json_object = Hash[String, json_value]
|
|
17
|
-
type json_array = Array[json_value]
|
|
18
|
-
type json_value = json_scalar | json_object | json_array
|
|
19
|
-
|
|
20
2
|
# Common types used across the library
|
|
21
3
|
type params_type = Hash[untyped, untyped] | Array[untyped] | nil
|
|
22
4
|
type id_type = String | Integer | nil
|
|
23
5
|
type data_type = Hash[untyped, untyped] | Array[untyped] | String | Numeric | bool | nil
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
type symbol_hash = Hash[Symbol, untyped] & _ToJson
|
|
27
|
-
|
|
28
|
-
class Error < StandardError
|
|
29
|
-
attr_reader code: Integer
|
|
30
|
-
attr_reader message: String
|
|
31
|
-
attr_reader data: data_type
|
|
32
|
-
attr_accessor request_id: Integer | String | nil
|
|
33
|
-
|
|
34
|
-
def initialize: (code: Integer, message: String, ?data: data_type, ?request_id: id_type) -> void
|
|
35
|
-
def to_h: -> symbol_hash
|
|
36
|
-
def to_json: (*untyped) -> String
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def validate_code: (Integer) -> void
|
|
41
|
-
def validate_message: (String) -> void
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
class ParseError < Error
|
|
45
|
-
def initialize: (?data: data_type, ?request_id: id_type) -> void
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
class InvalidRequestError < Error
|
|
49
|
-
def initialize: (?data: data_type, ?request_id: id_type) -> void
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
class MethodNotFoundError < Error
|
|
53
|
-
def initialize: (?data: data_type, ?request_id: id_type) -> void
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
class InvalidParamsError < Error
|
|
57
|
-
def initialize: (?data: data_type, ?request_id: id_type) -> void
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
class InternalError < Error
|
|
61
|
-
def initialize: (?data: data_type, ?request_id: id_type) -> void
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
class Request
|
|
65
|
-
attr_reader jsonrpc: String
|
|
66
|
-
attr_reader method: String
|
|
67
|
-
attr_reader params: params_type
|
|
68
|
-
attr_reader id: id_type
|
|
69
|
-
|
|
70
|
-
def initialize: (method: String, ?params: params_type, id: id_type) -> void
|
|
71
|
-
def to_h: -> symbol_hash
|
|
72
|
-
def to_json: (*untyped) -> String
|
|
73
|
-
|
|
74
|
-
private
|
|
75
|
-
|
|
76
|
-
def validate_method: (String) -> void
|
|
77
|
-
def validate_params: (params_type) -> void
|
|
78
|
-
def validate_id: (id_type) -> void
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
class Response
|
|
82
|
-
attr_reader jsonrpc: String
|
|
83
|
-
attr_reader result: untyped
|
|
84
|
-
attr_reader error: Error?
|
|
85
|
-
attr_reader id: id_type
|
|
86
|
-
|
|
87
|
-
def initialize: (?result: untyped, ?error: Error?, id: id_type) -> void
|
|
88
|
-
def success?: -> bool
|
|
89
|
-
def error?: -> bool
|
|
90
|
-
def to_h: -> symbol_hash
|
|
91
|
-
def to_json: (*untyped) -> String
|
|
92
|
-
|
|
93
|
-
private
|
|
94
|
-
|
|
95
|
-
def validate_result_and_error: (untyped, Error?) -> void
|
|
96
|
-
def validate_id: (id_type) -> void
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
class Notification
|
|
100
|
-
attr_reader jsonrpc: String
|
|
101
|
-
attr_reader method: String
|
|
102
|
-
attr_reader params: params_type
|
|
103
|
-
|
|
104
|
-
def initialize: (method: String, ?params: params_type) -> void
|
|
105
|
-
def to_h: -> symbol_hash
|
|
106
|
-
def to_json: (*untyped) -> String
|
|
107
|
-
|
|
108
|
-
private
|
|
109
|
-
def validate_method: (String) -> void
|
|
110
|
-
def validate_params: (params_type) -> void
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
class BatchRequest
|
|
114
|
-
include Enumerable[Request | Notification]
|
|
115
|
-
|
|
116
|
-
attr_reader requests: Array[Request | Notification]
|
|
117
|
-
|
|
118
|
-
def initialize: (Array[Request | Notification]) -> void
|
|
119
|
-
def to_h: -> Array[symbol_hash]
|
|
120
|
-
def to_json: (*untyped) -> String
|
|
121
|
-
def each: () { (Request | Notification) -> void } -> self
|
|
122
|
-
| () -> Enumerator[Request | Notification, self]
|
|
123
|
-
|
|
124
|
-
private
|
|
125
|
-
|
|
126
|
-
def validate_requests: (Array[untyped]) -> void
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
class BatchResponse
|
|
130
|
-
include Enumerable[Response]
|
|
131
|
-
|
|
132
|
-
attr_reader responses: Array[Response]
|
|
133
|
-
|
|
134
|
-
def initialize: (Array[Response]) -> void
|
|
135
|
-
def to_h: -> Array[symbol_hash]
|
|
136
|
-
def to_json: (*untyped) -> String
|
|
137
|
-
def each: () { (Response) -> void } -> self
|
|
138
|
-
| () -> Enumerator[Response, self]
|
|
139
|
-
|
|
140
|
-
private
|
|
141
|
-
|
|
142
|
-
def validate_responses: (Array[untyped]) -> void
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
module Errors
|
|
146
|
-
class Error = JSONRPC::Error
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
# External library signatures
|
|
151
|
-
module Zeitwerk
|
|
152
|
-
class Loader
|
|
153
|
-
def self.for_gem: () -> Loader
|
|
154
|
-
def enable_reloading: () -> void
|
|
155
|
-
def collapse: (String) -> void
|
|
156
|
-
def setup: () -> void
|
|
157
|
-
def eager_load: () -> void
|
|
158
|
-
end
|
|
159
|
-
end
|
|
7
|
+
VERSION: String
|
|
160
8
|
|
|
161
|
-
|
|
162
|
-
def self.
|
|
163
|
-
def self.generate: (untyped, ?untyped) -> String
|
|
9
|
+
def self.configure: () { (Configuration) -> void } -> void
|
|
10
|
+
def self.configuration: -> Configuration
|
|
164
11
|
end
|
data/sig/multi_json.rbs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module MultiJson
|
|
2
|
+
class ParseError < StandardError
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
interface _Adapter
|
|
6
|
+
def name: () -> String
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
interface _Readable
|
|
10
|
+
def read: () -> String
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.load: (String | _Readable string, Hash[interned, untyped]) -> Object?
|
|
14
|
+
def self.dump: (Object object, *Hash[interned, untyped] options) -> String
|
|
15
|
+
def self.use: (Symbol, String, Module, nil) -> untyped
|
|
16
|
+
def self.adapter: () -> _Adapter
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Representing JSON-compatible types
|
|
2
|
+
type json_scalar = String | Integer | Float | bool | nil
|
|
3
|
+
type json_object = Hash[String, json_value]
|
|
4
|
+
type json_array = Array[json_value]
|
|
5
|
+
type json_value = json_scalar | json_object | json_array
|
|
6
|
+
|
|
7
|
+
# Hash with Symbol keys
|
|
8
|
+
type symbol_hash = Hash[Symbol, untyped] & _ToJson
|
|
9
|
+
|
|
10
|
+
# Hash with String or Symbol keys
|
|
11
|
+
type interned_hash = Hash[interned, untyped] & _ToJson
|
data/sig/zeitwerk.rbs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# External library signatures
|
|
2
|
+
module Zeitwerk
|
|
3
|
+
class Loader
|
|
4
|
+
def self.for_gem: () -> Loader
|
|
5
|
+
def enable_reloading: () -> void
|
|
6
|
+
def collapse: (*(String | Pathname | Array[String | Pathname])) -> void
|
|
7
|
+
def setup: () -> void
|
|
8
|
+
def eager_load: (?force: boolish) -> void
|
|
9
|
+
end
|
|
10
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jsonrpc-middleware
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wilson Silva
|
|
@@ -9,6 +9,20 @@ bindir: exe
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: dry-struct
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.8'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.8'
|
|
12
26
|
- !ruby/object:Gem::Dependency
|
|
13
27
|
name: dry-validation
|
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -23,20 +37,34 @@ dependencies:
|
|
|
23
37
|
- - "~>"
|
|
24
38
|
- !ruby/object:Gem::Version
|
|
25
39
|
version: '1.11'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: multi_json
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '1.21'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '1.21'
|
|
26
54
|
- !ruby/object:Gem::Dependency
|
|
27
55
|
name: zeitwerk
|
|
28
56
|
requirement: !ruby/object:Gem::Requirement
|
|
29
57
|
requirements:
|
|
30
58
|
- - "~>"
|
|
31
59
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '2.
|
|
60
|
+
version: '2.8'
|
|
33
61
|
type: :runtime
|
|
34
62
|
prerelease: false
|
|
35
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
64
|
requirements:
|
|
37
65
|
- - "~>"
|
|
38
66
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '2.
|
|
67
|
+
version: '2.8'
|
|
40
68
|
description: A Rack middleware implementing the JSON-RPC 2.0 protocol that integrates
|
|
41
69
|
easily with all Rack-based applications (Rails, Sinatra, Hanami, etc).
|
|
42
70
|
email:
|
|
@@ -46,20 +74,25 @@ extensions: []
|
|
|
46
74
|
extra_rdoc_files: []
|
|
47
75
|
files:
|
|
48
76
|
- ".aiignore"
|
|
49
|
-
- ".claude/
|
|
50
|
-
- ".claude/
|
|
51
|
-
- ".claude/
|
|
52
|
-
- ".
|
|
77
|
+
- ".claude/agents/entire-search.md"
|
|
78
|
+
- ".claude/agents/rbs-specialist.md"
|
|
79
|
+
- ".claude/settings.json"
|
|
80
|
+
- ".devcontainer/devcontainer.json"
|
|
81
|
+
- ".dockerignore"
|
|
53
82
|
- ".editorconfig"
|
|
83
|
+
- ".entire/.gitignore"
|
|
84
|
+
- ".entire/settings.json"
|
|
54
85
|
- ".env.example"
|
|
55
86
|
- ".overcommit.yml"
|
|
56
87
|
- ".rspec"
|
|
57
88
|
- ".rubocop.yml"
|
|
58
89
|
- ".tool-versions"
|
|
59
|
-
- ".
|
|
90
|
+
- ".yard-lint.yml"
|
|
91
|
+
- AGENTS.md
|
|
60
92
|
- CHANGELOG.md
|
|
61
93
|
- CLAUDE.md
|
|
62
94
|
- CODE_OF_CONDUCT.md
|
|
95
|
+
- Dockerfile
|
|
63
96
|
- Guardfile
|
|
64
97
|
- LICENSE.txt
|
|
65
98
|
- README.md
|
|
@@ -144,11 +177,30 @@ files:
|
|
|
144
177
|
- lib/jsonrpc/railtie/routes_dsl.rb
|
|
145
178
|
- lib/jsonrpc/request.rb
|
|
146
179
|
- lib/jsonrpc/response.rb
|
|
180
|
+
- lib/jsonrpc/types.rb
|
|
147
181
|
- lib/jsonrpc/validator.rb
|
|
148
182
|
- lib/jsonrpc/version.rb
|
|
183
|
+
- rbs_collection.lock.yaml
|
|
184
|
+
- rbs_collection.yaml
|
|
149
185
|
- sig/jsonrpc.rbs
|
|
186
|
+
- sig/jsonrpc/batch_request.rbs
|
|
187
|
+
- sig/jsonrpc/batch_response.rbs
|
|
188
|
+
- sig/jsonrpc/configuration.rbs
|
|
189
|
+
- sig/jsonrpc/error.rbs
|
|
190
|
+
- sig/jsonrpc/errors/internal_error.rbs
|
|
191
|
+
- sig/jsonrpc/errors/invalid_params_error.rbs
|
|
192
|
+
- sig/jsonrpc/errors/invalid_request_error.rbs
|
|
193
|
+
- sig/jsonrpc/errors/method_not_found_error.rbs
|
|
194
|
+
- sig/jsonrpc/errors/parse_error.rbs
|
|
150
195
|
- sig/jsonrpc/middleware.rbs
|
|
196
|
+
- sig/jsonrpc/notification.rbs
|
|
151
197
|
- sig/jsonrpc/parser.rbs
|
|
198
|
+
- sig/jsonrpc/request.rbs
|
|
199
|
+
- sig/jsonrpc/response.rbs
|
|
200
|
+
- sig/jsonrpc/validator.rbs
|
|
201
|
+
- sig/multi_json.rbs
|
|
202
|
+
- sig/type_definitions.rbs
|
|
203
|
+
- sig/zeitwerk.rbs
|
|
152
204
|
homepage: https://github.com/wilsonsilva/jsonrpc-middleware
|
|
153
205
|
licenses:
|
|
154
206
|
- MIT
|
|
@@ -171,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
223
|
- !ruby/object:Gem::Version
|
|
172
224
|
version: '0'
|
|
173
225
|
requirements: []
|
|
174
|
-
rubygems_version:
|
|
226
|
+
rubygems_version: 4.0.12
|
|
175
227
|
specification_version: 4
|
|
176
228
|
summary: Rack middleware implementing the JSON-RPC 2.0 protocol.
|
|
177
229
|
test_files: []
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
# Document
|
|
2
|
-
|
|
3
|
-
Generates documentation for Ruby code using YARD with 100% coverage enforcement.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
Generate documentation:
|
|
8
|
-
```bash
|
|
9
|
-
bundle exec rake yard
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Format YARD comments:
|
|
13
|
-
```bash
|
|
14
|
-
bundle exec rake yard:format
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Verify 100% documentation coverage:
|
|
18
|
-
```bash
|
|
19
|
-
bundle exec rake verify_measurements
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Check for documentation quality issues:
|
|
23
|
-
```bash
|
|
24
|
-
bundle exec rake yard:junk
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Generate coverage report:
|
|
28
|
-
```bash
|
|
29
|
-
bundle exec rake yardstick_measure
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Configuration
|
|
33
|
-
|
|
34
|
-
Requires `.yardstick.yml` in project root with 100% threshold:
|
|
35
|
-
```yaml
|
|
36
|
-
threshold: 100
|
|
37
|
-
rules:
|
|
38
|
-
ApiTag::Presence: { enabled: true }
|
|
39
|
-
ApiTag::Inclusion: { enabled: true }
|
|
40
|
-
ApiTag::ProtectedMethod: { enabled: true }
|
|
41
|
-
ApiTag::PrivateMethod: { enabled: true }
|
|
42
|
-
ExampleTag: { enabled: true }
|
|
43
|
-
ReturnTag: { enabled: true }
|
|
44
|
-
Summary::Presence: { enabled: true }
|
|
45
|
-
Summary::Delimiter: { enabled: true }
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Coverage Report
|
|
49
|
-
|
|
50
|
-
After running measurement, check detailed line-by-line issues:
|
|
51
|
-
```bash
|
|
52
|
-
cat measurements/report.txt
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Report shows specific file, line number, method, and documentation issues that need fixing.
|
|
56
|
-
|
|
57
|
-
## Documentation Standards
|
|
58
|
-
|
|
59
|
-
### Required Tags
|
|
60
|
-
- Every public/private method, class, and module requires `@api public` or `@api private`
|
|
61
|
-
- All parameters: `@param name [Type] Description`
|
|
62
|
-
- All returns: `@return [Type] Description` (use `[void]` if no return)
|
|
63
|
-
- Examples required for all public methods: `@example Description`
|
|
64
|
-
- Error conditions: `@raise [ExceptionClass] When this occurs`
|
|
65
|
-
|
|
66
|
-
### Type Notation
|
|
67
|
-
- Use `String` not `string`
|
|
68
|
-
- Arrays: `Array<String>` for string arrays
|
|
69
|
-
- Hashes: `Hash{String=>Object}` for hash types
|
|
70
|
-
- Use `Boolean` not `bool`, `Integer` not `int`
|
|
71
|
-
- Nullable types: `String, nil` or `String|nil`
|
|
72
|
-
|
|
73
|
-
### Formatting Rules
|
|
74
|
-
- Blank lines required between YARD tag groups
|
|
75
|
-
- Exception: `@param` and `@option` tags can be grouped together
|
|
76
|
-
- Wrap class/method names in `+` markers: `+PrivateKey+`
|
|
77
|
-
- Cross-reference related methods: `@see #other_method`
|
|
78
|
-
|
|
79
|
-
### Documentation Structure
|
|
80
|
-
```ruby
|
|
81
|
-
# Brief one-line summary ending with period.
|
|
82
|
-
#
|
|
83
|
-
# @api public
|
|
84
|
-
#
|
|
85
|
-
# @example Description of example
|
|
86
|
-
# code_example
|
|
87
|
-
# result # => expected_output
|
|
88
|
-
#
|
|
89
|
-
# @param name [Type] Description
|
|
90
|
-
# @param other [Type] Other description
|
|
91
|
-
#
|
|
92
|
-
# @return [Type] Description
|
|
93
|
-
#
|
|
94
|
-
# @raise [ExceptionClass] When this exception occurs
|
|
95
|
-
#
|
|
96
|
-
def method_name
|
|
97
|
-
end
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Integration
|
|
101
|
-
|
|
102
|
-
Documentation verification is included in the quality assurance pipeline:
|
|
103
|
-
```bash
|
|
104
|
-
bundle exec rake qa
|
|
105
|
-
```
|