yard-lint 1.13.0 → 1.13.1

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: 0d39655294fb2b081cdf0d1a5368885d92eb22539388ceb2ae3fb958b6d2d93b
4
- data.tar.gz: 1bfb22d9799f371940b25ea4746906b0c5234559df039196ed1ccb80d64aa18f
3
+ metadata.gz: c16ecb156acd4118a7f6b11de2426ea4194789350e794b300a17a5608ed88c6f
4
+ data.tar.gz: 1700cd0522e3fd7ba3041e170f7a6c6c2d407cac819808571e77907355bbb5ed
5
5
  SHA512:
6
- metadata.gz: 92a9ba145cb27155603bc8d85266b1b0d6c98f761a03041a58a4014c1f770732cbef3ff0aeeb3f5afb5b7d3fa460ba26aa60f7043e4dcc629bfe65aad0e6c471
7
- data.tar.gz: 9c9bfb37d5c4ce1dcc473156fb7f555aa388d1433b61b53371e275135e64b56b5f729a7413a0c1683d524672f6e22d7b34d722e37de9cb195b95e18a5fb0cab2
6
+ metadata.gz: 69ef7bafbb9c41c27857d0247c30fbcc5dc880663a16f4d90088afa594c4ea3fac8a447e66f041aae501786f91fa5b75a21d83f25679dbbfb8d1ff287709902b
7
+ data.tar.gz: 7089ac1747b1473388efaafdb1e899ac3888fa71f31d696b408b5dcdc924ccd69ebaaa466efba90631e59d42cd9c87522d2ca482d5137e68f6dd089149da2474
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.13.1 (2026-11-02)
2
+ - **[Bugfix]** `Documentation/UndocumentedBooleanMethods` no longer slows down with the square of the number of methods in a class or module (a module with 4200 methods: about 3 s to 40 ms). The `module_function` twin lookup it shares with the separator, `Tags/OverloadConsistency` and `Documentation/ReferenceTypo` validators now reads the registry by path instead of scanning the namespace's children.
3
+
1
4
  ## 1.13.0 (2026-10-25)
2
5
  - **[Feature]** Added `Tags/OverloadConsistency` (enabled by default, severity `warning`), which checks the tags of each `@overload` against that overload's own signature: a `@param` not in the signature, a parameter without `@param` in an overload that documents others (a method-level `@param` counts for every overload), and an overload without `@return` when other overloads have one.
3
6
  - **[Feature]** Added `Documentation/ReferenceTypo` (enabled by default, severity `warning`), which flags probable typos in `{Foo#bar}` links and `@see` targets and suggests the closest name via `DidYouMean`.
@@ -137,9 +137,8 @@ module Yard
137
137
  # @return [Boolean] true if the object's docstring is a normalized copy
138
138
  def module_function_copy?(object)
139
139
  return false unless object.type == :method
140
- # Checked before the twin lookup, which scans the namespace's children:
141
- # an object YARD tracked back to source lines is authored, whatever it
142
- # is paired with, and most objects are
140
+ # Checked before the twin lookup: an object YARD tracked back to source
141
+ # lines is authored, whatever it is paired with, and most objects are
143
142
  return false if object.docstring.line_range
144
143
 
145
144
  twin = module_function_twin(object)
@@ -155,16 +154,15 @@ module Yard
155
154
  # when the object does not come from module_function
156
155
  def module_function_twin(object)
157
156
  return nil unless object.respond_to?(:scope)
158
- # `def CONST.name` leaves a Proxy or ConstantObject namespace with no
159
- # children; Proxy#is_a? answers for the resolved object
157
+ # Only a module defines module functions; `def CONST.name` leaves a Proxy
158
+ # or ConstantObject namespace. Proxy#is_a? answers for the resolved object
160
159
  return nil unless object.namespace.is_a?(YARD::CodeObjects::NamespaceObject)
161
160
 
162
- twin = object.namespace.child(
163
- name: object.name,
164
- scope: (object.scope == :class) ? :instance : :class
165
- )
161
+ # Looked up by path: a children scan per object is quadratic in the
162
+ # number of methods of a namespace
163
+ twin = YARD::Registry.at(module_function_twin_path(object))
166
164
 
167
- return nil unless twin
165
+ return nil unless twin.is_a?(YARD::CodeObjects::MethodObject)
168
166
  return nil unless twin.file == object.file && twin.line == object.line
169
167
  # Both halves point at the same definition, but only the class method
170
168
  # is flagged as a module function by YARD.
@@ -173,6 +171,23 @@ module Yard
173
171
  twin
174
172
  end
175
173
 
174
+ # Builds the registry path of the method with the same name and the other
175
+ # scope, the way YARD::CodeObjects::MethodObject#path does
176
+ # @param object [YARD::CodeObjects::MethodObject] one half of the pair
177
+ # @return [String] the registry path of the other half
178
+ def module_function_twin_path(object)
179
+ namespace = object.namespace
180
+
181
+ separator =
182
+ if object.scope == :instance
183
+ namespace.root? ? YARD::CodeObjects::NSEP : YARD::CodeObjects::CSEP
184
+ else
185
+ YARD::CodeObjects::ISEP
186
+ end
187
+
188
+ "#{namespace.path}#{separator}#{object.name}"
189
+ end
190
+
176
191
  # Converts a zero-based line offset within a docstring's text into an
177
192
  # absolute line number in the source file, so offenses can point at
178
193
  # the offending documentation line instead of the definition line.
@@ -3,6 +3,6 @@
3
3
  module Yard
4
4
  module Lint
5
5
  # @return [String] version of the YARD Lint gem
6
- VERSION = '1.13.0'
6
+ VERSION = '1.13.1'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld