decode 0.24.4 → 0.24.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69a1cefaeaebe1d53746d8244acad208122dccd964ef8ded1c70b7f3e1ab856f
4
- data.tar.gz: f3ef222826e20af488964480baf64d72ee9b55a6ad849057f40eebe09934ca37
3
+ metadata.gz: 91c5a87fbfc1bcd6967d833aebc9dc5a60286b4c1037041e24ef46f69461f2af
4
+ data.tar.gz: 35ee291f1b2ca2d61b06b64c2ed6112789fb70515379a0fb82384c9d8c4a34cd
5
5
  SHA512:
6
- metadata.gz: a2c97db6ff06407597b2c42513a0cb4827824abb41ec480a8e6fb1e2d3b8c4366e61c2d34f1f2f706d3cee33f6be6ff5464ef8e668e491534a9692954d14bba3
7
- data.tar.gz: f051d9ea291738263feee8091a40137ca4578316f762b6d93ef26dc03001f1a138d26a25878c39a7029eee4f59a742a2d59492a1b0ac55a77c8312d28de53a86
6
+ metadata.gz: 83069393060cd00d008a6ba267a719af5fb0cf3e31426814da9bab6a0e668dd025877fd7008d1185dcfb87810318c82c02d60f297558f6c17025c3e9c2080e5d
7
+ data.tar.gz: 29962ee76526d90a7661b8b1afb3f606d1abde809987bd0d62d4d3b0cf2282121089bfe645686c8e2e70c05a6b69ddfcfb4d1bde26b4806b9679cdd8d99a43b6
checksums.yaml.gz.sig CHANGED
Binary file
data/bake/decode/index.rb CHANGED
@@ -22,7 +22,7 @@ def coverage(root)
22
22
  public_definition = node.values.nil?
23
23
 
24
24
  node.values&.each do |definition|
25
- if definition.public?
25
+ if definition.coverage_relevant?
26
26
  level = path.size
27
27
 
28
28
  if definition.documented?
data/context/coverage.md CHANGED
@@ -254,7 +254,7 @@ def coverage_percentage(root)
254
254
 
255
255
  index.trie.traverse do |path, node, descend|
256
256
  node.values&.each do |definition|
257
- if definition.public?
257
+ if definition.coverage_relevant?
258
258
  total += 1
259
259
  documented += 1 if definition.comments&.any?
260
260
  end
@@ -82,6 +82,11 @@ module Decode
82
82
  true
83
83
  end
84
84
 
85
+ # @returns [bool] If the definition should be counted in coverage metrics.
86
+ def coverage_relevant?
87
+ self.public?
88
+ end
89
+
85
90
  # Whether the definition has documentation.
86
91
  # @returns [bool] True if the definition has non-empty comments.
87
92
  def documented?
@@ -21,6 +21,12 @@ module Decode
21
21
 
22
22
  attr :old_name
23
23
 
24
+ # Aliases don't require separate documentation as they reference existing methods.
25
+ # @returns [bool] Always false for aliases.
26
+ def coverage_relevant?
27
+ false
28
+ end
29
+
24
30
  # Generate a short form representation of the alias.
25
31
  def short_form
26
32
  "alias #{self.name} #{@old_name}"
@@ -6,6 +6,9 @@
6
6
  module Decode
7
7
  # Represents a location in a source file.
8
8
  class Location
9
+ # Initialize a new location.
10
+ # @parameter path [String] The path to the source file.
11
+ # @parameter line [Integer] The line number in the source file.
9
12
  def initialize(path, line)
10
13
  @path = path
11
14
  @line = line
@@ -164,7 +164,7 @@ module Decode
164
164
  # Handle rest parameter (*args):
165
165
  if node.parameters.respond_to?(:rest) && node.parameters.rest
166
166
  rest_param = node.parameters.rest
167
- name = rest_param.name || :args
167
+ name = rest_param.respond_to?(:name) && rest_param.name ? rest_param.name : :args
168
168
  base_type = doc_types[name.to_s] || ::RBS::Parser.parse_type("untyped")
169
169
 
170
170
  rest_positionals = ::RBS::Types::Function::Param.new(
@@ -192,7 +192,7 @@ module Decode
192
192
  # Handle keyword rest parameter (**kwargs):
193
193
  if node.parameters.respond_to?(:keyword_rest) && node.parameters.keyword_rest
194
194
  rest_param = node.parameters.keyword_rest
195
- if rest_param.name
195
+ if rest_param.respond_to?(:name) && rest_param.name
196
196
  name = rest_param.name
197
197
  base_type = doc_types[name.to_s] || ::RBS::Parser.parse_type("untyped")
198
198
 
@@ -321,7 +321,7 @@ module Decode
321
321
  # Handle rest parameter (*args):
322
322
  if node.parameters.respond_to?(:rest) && node.parameters.rest
323
323
  rest_param = node.parameters.rest
324
- name = rest_param.name || :args
324
+ name = rest_param.respond_to?(:name) && rest_param.name ? rest_param.name : :args
325
325
  base_type = doc_types[name.to_s] || ::RBS::Parser.parse_type("untyped")
326
326
  # Rest parameters should be `Array[T]`:
327
327
  array_type = ::RBS::Types::ClassInstance.new(
@@ -407,7 +407,7 @@ module Decode
407
407
  # Handle keyword rest parameter (**kwargs):
408
408
  if node.parameters.respond_to?(:keyword_rest) && node.parameters.keyword_rest
409
409
  rest_param = node.parameters.keyword_rest
410
- if rest_param.name
410
+ if rest_param.respond_to?(:name) && rest_param.name
411
411
  name = rest_param.name
412
412
  base_type = doc_types[name.to_s] || ::RBS::Parser.parse_type("untyped")
413
413
  # Keyword rest should be `Hash[Symbol, T]`:
@@ -8,6 +8,7 @@ require "console"
8
8
 
9
9
  module Decode
10
10
  module RBS
11
+ # Utilities for working with RBS types.
11
12
  module Type
12
13
  # Check if an RBS type represents a nullable/optional type
13
14
  # This method recursively traverses the type tree to find nil anywhere
data/lib/decode/trie.rb CHANGED
@@ -14,7 +14,7 @@ module Decode
14
14
  # Initialize an empty node.
15
15
  def initialize
16
16
  @children = {}
17
- @values = []
17
+ @values = nil
18
18
  end
19
19
 
20
20
  # Generate a string representation of this node.
@@ -5,5 +5,5 @@
5
5
 
6
6
  module Decode
7
7
  # @constant [String] The version of the gem.
8
- VERSION = "0.24.4"
8
+ VERSION = "0.24.6"
9
9
  end
data/sig/decode.rbs CHANGED
@@ -852,7 +852,8 @@ module Decode
852
852
 
853
853
  @line: Integer
854
854
 
855
- public def initialize: (untyped path, untyped line) -> void
855
+ # Initialize a new location.
856
+ public def initialize: (String path, Integer line) -> void
856
857
 
857
858
  # Generate a string representation of the location.
858
859
  public def to_s: () -> untyped
@@ -994,6 +995,7 @@ module Decode
994
995
  private def build_attributes_rbs: (Array attribute_definitions) -> Array
995
996
  end
996
997
 
998
+ # Utilities for working with RBS types.
997
999
  module Type
998
1000
  # Check if an RBS type represents a nullable/optional type
999
1001
  # This method recursively traverses the type tree to find nil anywhere
data.tar.gz.sig CHANGED
@@ -1,5 +1,4 @@
1
- q�ʭ�����v�_��x�^��ztaFD�P^Z�#&㾍�T�s:A
2
- $�CD�ūb��Ȅm�$(燸�}�K�Dr��Y�\Wv��=e'�f��cK�4�`VE�ϸ���*�l��i��$��JM�_�c�IC *��#&DQ��K��h~8���+�߇����I:�� ��?@Wr�TN�E�˕�hv
3
- ����iq zTG2闙@�����
4
- ��5��@�l*�K
5
- ۜ��Õ�کs����-:������g�������`�pX8��*e
1
+ -@+��R\
2
+ �@13��xV��#�
3
+ Mn'�ĀG83f�P�#8�S��7DK=-r$�
4
+ L�+�������� u?���k�� ݣd=���ӳ
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.4
4
+ version: 0.24.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.6.7
159
+ rubygems_version: 3.6.9
160
160
  specification_version: 4
161
161
  summary: Code analysis for documentation generation.
162
162
  test_files: []
metadata.gz.sig CHANGED
Binary file