ruby-merge 7.1.1 → 7.1.4
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
- checksums.yaml.gz.sig +0 -0
- data/README.md +3 -11
- data/lib/ruby/merge/block_directive_detector.rb +17 -5
- data/lib/ruby/merge/doc_comment_support.rb +4 -0
- data/lib/ruby/merge/gemspec_support.rb +1 -0
- data/lib/ruby/merge/magic_comment_support.rb +4 -0
- data/lib/ruby/merge/method_similarity.rb +6 -0
- data/lib/ruby/merge/nocov_node_base.rb +4 -0
- data/lib/ruby/merge/rescue_semantics.rb +11 -1
- data/lib/ruby/merge/scaffold_chunk_support.rb +1 -0
- data/lib/ruby/merge/signature_support.rb +1 -0
- data/lib/ruby/merge/version.rb +1 -1
- data/lib/ruby/merge.rb +102 -27
- data.tar.gz.sig +0 -0
- metadata +20 -20
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e110369618446503145375467571c154f6f20f6a9a9e2ea1aec9fc87c2557618
|
|
4
|
+
data.tar.gz: ec6e31d2f85b299976139c80f2dee4574d6ef70fb721bcb514b36eddd995a5a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b15e47b8e03c0da7a237edb9826ea7c05d4cc7c510cbd9c6d31b32d0a4787a2510d869b86cf6bd7c9b9c836bdcd6d4a9b57a921bb679f74d9a665daac2730a4e
|
|
7
|
+
data.tar.gz: c69a81757def5610a400599c3fa9b3459557b5c88c09be084c37e240cdfa00a8d50f7909bf63cf1b30ccc34ab20890d6fa3c6d4d49bca747246340216c7e1b03
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.md
CHANGED
|
@@ -46,7 +46,7 @@ I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-ta
|
|
|
46
46
|
|
|
47
47
|
### Compatibility
|
|
48
48
|
|
|
49
|
-
Compatible with MRI Ruby 4.0.0+,
|
|
49
|
+
Compatible with MRI Ruby 4.0.0+, JRuby, and TruffleRuby.
|
|
50
50
|
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
|
|
51
51
|
This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
|
|
52
52
|
may be higher than the gem's runtime compatibility floor when legacy Rubies are
|
|
@@ -122,20 +122,12 @@ See [SECURITY.md][🔐security].
|
|
|
122
122
|
## 🤝 Contributing
|
|
123
123
|
|
|
124
124
|
If you need some ideas of where to help, you could work on adding more code coverage,
|
|
125
|
-
|
|
126
|
-
or use the gem and think about how it could be better.
|
|
125
|
+
check [issues][🤝gh-issues] or [PRs][🤝gh-pulls], or use the gem and think about how it could be better.
|
|
127
126
|
|
|
128
127
|
We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
|
|
129
128
|
|
|
130
129
|
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
131
130
|
|
|
132
|
-
### Code Coverage
|
|
133
|
-
|
|
134
|
-
<details markdown="1">
|
|
135
|
-
<summary>Coverage service badges</summary>
|
|
136
|
-
|
|
137
|
-
</details>
|
|
138
|
-
|
|
139
131
|
## 📌 Versioning
|
|
140
132
|
|
|
141
133
|
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
@@ -275,7 +267,7 @@ If none of the available licenses suit your use case, please [contact us](mailto
|
|
|
275
267
|
[📌gitmoji]: https://gitmoji.dev
|
|
276
268
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
277
269
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
278
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-
|
|
270
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-2.006-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
279
271
|
[🔐security]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/SECURITY.md
|
|
280
272
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
281
273
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -7,6 +7,10 @@ module Ruby
|
|
|
7
7
|
# This is Ruby-specific substrate behavior shared by Ruby parser providers.
|
|
8
8
|
# Parser-specific gems may consume the spans and project them into their own
|
|
9
9
|
# node types, but directive token semantics should live here.
|
|
10
|
+
# Directive scanning intentionally keeps the paired-stack validation in one
|
|
11
|
+
# class so every caller receives identical malformed-input diagnostics.
|
|
12
|
+
# rubocop:disable Metrics/AbcSize, Metrics/BlockLength, Metrics/ClassLength
|
|
13
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
10
14
|
class BlockDirectiveDetector
|
|
11
15
|
Span = Struct.new(:kind, :start_line, :end_line, :open_marker, :close_marker, keyword_init: true)
|
|
12
16
|
|
|
@@ -174,9 +178,10 @@ module Ruby
|
|
|
174
178
|
next if first_index == second_index || invalid_indices.include?(second_index)
|
|
175
179
|
next unless crossing_spans?(first, second)
|
|
176
180
|
|
|
177
|
-
report_unbalanced(
|
|
178
|
-
"(lines #{first.start_line}..#{first.end_line}) and
|
|
179
|
-
"(lines #{second.start_line}..#{second.end_line}) - both treated as plain comments"
|
|
181
|
+
report_unbalanced(
|
|
182
|
+
"offset-overlapping #{first.kind} block (lines #{first.start_line}..#{first.end_line}) and " \
|
|
183
|
+
"#{second.kind} block (lines #{second.start_line}..#{second.end_line}) - both treated as plain comments"
|
|
184
|
+
)
|
|
180
185
|
invalid_indices.add(first_index)
|
|
181
186
|
invalid_indices.add(second_index)
|
|
182
187
|
crossing = true
|
|
@@ -190,8 +195,13 @@ module Ruby
|
|
|
190
195
|
end
|
|
191
196
|
|
|
192
197
|
def crossing_spans?(first, second)
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
first_crosses_second = first.start_line < second.start_line &&
|
|
199
|
+
first.end_line > second.start_line &&
|
|
200
|
+
first.end_line < second.end_line
|
|
201
|
+
second_crosses_first = second.start_line < first.start_line &&
|
|
202
|
+
second.end_line > first.start_line &&
|
|
203
|
+
second.end_line < first.end_line
|
|
204
|
+
first_crosses_second || second_crosses_first
|
|
195
205
|
end
|
|
196
206
|
|
|
197
207
|
def top_level_spans_only(spans)
|
|
@@ -204,5 +214,7 @@ module Ruby
|
|
|
204
214
|
end
|
|
205
215
|
end
|
|
206
216
|
end
|
|
217
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
218
|
+
# rubocop:enable Metrics/AbcSize, Metrics/BlockLength, Metrics/ClassLength
|
|
207
219
|
end
|
|
208
220
|
end
|
|
@@ -68,6 +68,9 @@ module Ruby
|
|
|
68
68
|
nil
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
# Example extraction deliberately combines tag scanning and body slicing
|
|
72
|
+
# so the returned indexes remain tied to the original comment entries.
|
|
73
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
71
74
|
def example_blocks(entries)
|
|
72
75
|
normalized = entries.map { |entry| normalize_comment_content(entry[:raw]) }
|
|
73
76
|
normalized.each_with_index.filter_map do |content, tag_index|
|
|
@@ -92,6 +95,7 @@ module Ruby
|
|
|
92
95
|
}
|
|
93
96
|
end
|
|
94
97
|
end
|
|
98
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
95
99
|
end
|
|
96
100
|
end
|
|
97
101
|
end
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module Ruby
|
|
4
4
|
module Merge
|
|
5
5
|
# Ruby magic comment detection and file-header prefix handling.
|
|
6
|
+
# Header scanning intentionally preserves source order and duplicate entries
|
|
7
|
+
# because those details affect comment ownership during reconstruction.
|
|
8
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
6
9
|
module MagicCommentSupport
|
|
7
10
|
MAGIC_COMMENT_PATTERNS = {
|
|
8
11
|
frozen_string_literal: /^frozen_string_literal:\s*(true|false)$/i,
|
|
@@ -124,5 +127,6 @@ module Ruby
|
|
|
124
127
|
comment&.slice&.start_with?('#!')
|
|
125
128
|
end
|
|
126
129
|
end
|
|
130
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
127
131
|
end
|
|
128
132
|
end
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Ruby
|
|
4
4
|
module Merge
|
|
5
|
+
# Computes stable name/parameter similarity scores for Ruby methods.
|
|
6
|
+
#
|
|
7
|
+
# The dynamic-programming distance calculation is intentionally kept local
|
|
8
|
+
# to this value object so the matching contract stays easy to audit.
|
|
9
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
5
10
|
class MethodSimilarity
|
|
6
11
|
DEFAULT_NAME_WEIGHT = 0.7
|
|
7
12
|
DEFAULT_PARAMS_WEIGHT = 0.3
|
|
@@ -71,5 +76,6 @@ module Ruby
|
|
|
71
76
|
previous_row[m]
|
|
72
77
|
end
|
|
73
78
|
end
|
|
79
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
74
80
|
end
|
|
75
81
|
end
|
|
@@ -7,6 +7,9 @@ module Ruby
|
|
|
7
7
|
# Parser-specific merge gems subclass this when they need native AST location
|
|
8
8
|
# or comment attachment behavior. The structural Ruby semantics live here:
|
|
9
9
|
# nocov blocks follow file preference and match by their inner content.
|
|
10
|
+
# Nocov nodes preserve source locations and marker text as one structural
|
|
11
|
+
# unit; the initializer mirrors the node's complete serialized shape.
|
|
12
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
|
10
13
|
class NocovNodeBase
|
|
11
14
|
include Ast::Merge::BlockDirective
|
|
12
15
|
|
|
@@ -71,5 +74,6 @@ module Ruby
|
|
|
71
74
|
|
|
72
75
|
alias to_s inspect
|
|
73
76
|
end
|
|
77
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/ParameterLists, Metrics/PerceivedComplexity
|
|
74
78
|
end
|
|
75
79
|
end
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Ruby
|
|
4
4
|
module Merge
|
|
5
|
+
# Normalizes rescue clause ordering while preserving source-defined
|
|
6
|
+
# exception hierarchies and Ruby's broader-handler semantics.
|
|
7
|
+
# rubocop:disable Metrics/AbcSize, Metrics/ClassLength, Metrics/CyclomaticComplexity
|
|
8
|
+
# rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
5
9
|
class RescueSemantics
|
|
6
10
|
def initialize(source_defined_exception_definitions: [])
|
|
7
11
|
@source_defined_exception_definitions = source_defined_exception_definitions
|
|
@@ -123,7 +127,11 @@ module Ruby
|
|
|
123
127
|
else
|
|
124
128
|
candidate_name = qualify_source_constant_name(definition[:superclass],
|
|
125
129
|
definition[:namespace])
|
|
126
|
-
defined_names.include?(candidate_name)
|
|
130
|
+
if defined_names.include?(candidate_name)
|
|
131
|
+
candidate_name
|
|
132
|
+
else
|
|
133
|
+
normalize_exception_name(definition[:superclass])
|
|
134
|
+
end
|
|
127
135
|
end
|
|
128
136
|
|
|
129
137
|
hierarchy[definition[:name]] ||= superclass_name if superclass_name
|
|
@@ -205,5 +213,7 @@ module Ruby
|
|
|
205
213
|
!rescue_clause_covers?(right_clause_type, left_clause_type)
|
|
206
214
|
end
|
|
207
215
|
end
|
|
216
|
+
# rubocop:enable Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
217
|
+
# rubocop:enable Metrics/AbcSize, Metrics/ClassLength, Metrics/CyclomaticComplexity
|
|
208
218
|
end
|
|
209
219
|
end
|
data/lib/ruby/merge/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Ruby
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION = '7.1.
|
|
8
|
+
VERSION = '7.1.4'
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/ruby/merge.rb
CHANGED
|
@@ -17,6 +17,16 @@ require_relative 'merge/scaffold_chunk_support'
|
|
|
17
17
|
require_relative 'merge/signature_support'
|
|
18
18
|
|
|
19
19
|
module Ruby
|
|
20
|
+
# Public Ruby parser-family substrate for Structured Merge.
|
|
21
|
+
#
|
|
22
|
+
# The adapter deliberately keeps parser capability reporting, ownership
|
|
23
|
+
# discovery, merge planning, and source reconstruction together. Splitting
|
|
24
|
+
# those phases to satisfy generic size metrics would obscure the contract
|
|
25
|
+
# they implement and make provider behavior harder to audit.
|
|
26
|
+
# rubocop:disable Metrics/AbcSize, Metrics/BlockLength, Metrics/BlockNesting
|
|
27
|
+
# rubocop:disable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
28
|
+
# rubocop:disable Metrics/ModuleLength, Metrics/PerceivedComplexity
|
|
29
|
+
# rubocop:disable Style/MultilineBlockChain
|
|
20
30
|
module Merge
|
|
21
31
|
extend self
|
|
22
32
|
include Ast::Merge::SourceRegionReportSupport
|
|
@@ -39,7 +49,11 @@ module Ruby
|
|
|
39
49
|
REQUIRE_PATTERN = /^\s*require(?:_relative)?\s+["']([^"']+)["']/
|
|
40
50
|
CLASS_PATTERN = /^\s*class\s+([A-Z]\w*(?:::\w+)*)/
|
|
41
51
|
MODULE_PATTERN = /^\s*module\s+([A-Z]\w*(?:::\w+)*)/
|
|
42
|
-
DEF_PATTERN = %r{
|
|
52
|
+
DEF_PATTERN = %r{
|
|
53
|
+
^\s*def\s+
|
|
54
|
+
((?:self\.)?)
|
|
55
|
+
([a-zA-Z_]\w*[!?=]?|\[\]=?|\+@|-@|\*\*|<<|>>|<=>|===|==|=~|!~|!=|[+\-*/%&|^<>]=?|[!~`])
|
|
56
|
+
}x
|
|
43
57
|
CONSTANT_ASSIGNMENT_PATTERN = /^(\s*)([A-Z]\w*)\s*=/
|
|
44
58
|
CONSTANT_HASH_ASSIGNMENT_PATTERN = /^(\s*)([A-Z]\w*)\s*=\s*\{/
|
|
45
59
|
|
|
@@ -165,13 +179,16 @@ module Ruby
|
|
|
165
179
|
template_methods = ruby_method_projection(template_source, revision: 'template')
|
|
166
180
|
destination_methods = ruby_method_projection(destination_source, revision: 'destination')
|
|
167
181
|
destination_by_signature = destination_methods.to_h { |entry| [entry[:signature], entry] }
|
|
168
|
-
template_signatures = template_methods
|
|
182
|
+
template_signatures = template_methods
|
|
183
|
+
.map { |entry| entry[:signature] }
|
|
184
|
+
.to_h { |signature| [signature, true] }
|
|
169
185
|
|
|
170
186
|
matches = template_methods.filter_map do |template_entry|
|
|
171
187
|
destination_entry = destination_by_signature[template_entry[:signature]]
|
|
172
188
|
next unless destination_entry
|
|
173
189
|
|
|
174
|
-
moved = template_entry[:index] != destination_entry[:index] ||
|
|
190
|
+
moved = template_entry[:index] != destination_entry[:index] ||
|
|
191
|
+
template_entry[:parent_path] != destination_entry[:parent_path]
|
|
175
192
|
Ast::Merge::MoveDetectionMatch.new(
|
|
176
193
|
from_path: template_entry[:path],
|
|
177
194
|
to_path: destination_entry[:path],
|
|
@@ -184,7 +201,13 @@ module Ruby
|
|
|
184
201
|
from_index: template_entry[:index],
|
|
185
202
|
to_index: destination_entry[:index],
|
|
186
203
|
confidence: moved ? 0.98 : 0.9,
|
|
187
|
-
diagnostics: [
|
|
204
|
+
diagnostics: [
|
|
205
|
+
if moved
|
|
206
|
+
'same Ruby method signature observed at a different sibling position'
|
|
207
|
+
else
|
|
208
|
+
'same Ruby method signature observed at the same sibling position'
|
|
209
|
+
end
|
|
210
|
+
]
|
|
188
211
|
)
|
|
189
212
|
end
|
|
190
213
|
|
|
@@ -207,7 +230,9 @@ module Ruby
|
|
|
207
230
|
unmatched_to: destination_methods.reject do |entry|
|
|
208
231
|
template_signatures[entry[:signature]]
|
|
209
232
|
end.map { |entry| entry[:path] },
|
|
210
|
-
diagnostics: [
|
|
233
|
+
diagnostics: [
|
|
234
|
+
'Ruby method move detection uses generic move-detection matching over receiver-aware method projections'
|
|
235
|
+
]
|
|
211
236
|
).to_h
|
|
212
237
|
end
|
|
213
238
|
|
|
@@ -242,12 +267,15 @@ module Ruby
|
|
|
242
267
|
template_declarations_by_key = template_declarations.to_h { |entry| [entry[:merge_key], entry] }
|
|
243
268
|
intra_owner_merges = ruby_intra_owner_merge_plan(template_declarations, destination_declarations)
|
|
244
269
|
namespace_conflicts = ruby_namespace_form_conflicts(template_declarations, destination_declarations)
|
|
245
|
-
|
|
270
|
+
namespace_equivalence_available = TreeHaver::BackendRegistry.tag_available?(
|
|
271
|
+
:tslp_ruby_namespace_form_equivalence
|
|
272
|
+
)
|
|
273
|
+
unless namespace_conflicts.empty? || namespace_equivalence_available
|
|
246
274
|
conflicts = namespace_conflicts.join(', ')
|
|
247
275
|
return unsupported_feature_result(
|
|
248
276
|
'ruby-merge cannot reconcile equivalent Ruby namespace declaration forms with the active TSLP records: ' \
|
|
249
|
-
"#{conflicts}. Use
|
|
250
|
-
'records to tree-sitter-language-pack.'
|
|
277
|
+
"#{conflicts}. Use a native Ruby provider for native Ruby merging, or report missing Ruby namespace " \
|
|
278
|
+
'ownership records to tree-sitter-language-pack.'
|
|
251
279
|
)
|
|
252
280
|
end
|
|
253
281
|
if !namespace_conflicts.empty? && TreeHaver::BackendRegistry.tag_available?(:tslp_ruby_namespace_form_equivalence)
|
|
@@ -423,7 +451,8 @@ module Ruby
|
|
|
423
451
|
{
|
|
424
452
|
severity: 'info',
|
|
425
453
|
category: 'source_owner_identity_matching',
|
|
426
|
-
message: 'Ruby source-owner matching reports confidence per match and uses ordered structural pairing
|
|
454
|
+
message: 'Ruby source-owner matching reports confidence per match and uses ordered structural pairing ' \
|
|
455
|
+
'for duplicate identities.'
|
|
427
456
|
}
|
|
428
457
|
]
|
|
429
458
|
}
|
|
@@ -647,7 +676,11 @@ module Ruby
|
|
|
647
676
|
{
|
|
648
677
|
severity: owners_preserved ? 'info' : 'error',
|
|
649
678
|
category: owners_preserved ? 'formatter_adapter_accepted' : 'formatter_adapter_rejected',
|
|
650
|
-
message: owners_preserved
|
|
679
|
+
message: if owners_preserved
|
|
680
|
+
'Ruby formatter adapter preserved owner identity, conflict scope, and validation semantics.'
|
|
681
|
+
else
|
|
682
|
+
'Ruby formatter adapter changed owner identity and cannot be accepted as a semantic merge.'
|
|
683
|
+
end
|
|
651
684
|
}
|
|
652
685
|
]
|
|
653
686
|
}
|
|
@@ -693,7 +726,12 @@ module Ruby
|
|
|
693
726
|
{
|
|
694
727
|
severity: reconstruction_risk ? 'warning' : 'info',
|
|
695
728
|
category: reconstruction_risk ? 'ast_node_reconstruction_risk' : 'ast_node_merge_candidate',
|
|
696
|
-
message: reconstruction_risk
|
|
729
|
+
message: if reconstruction_risk
|
|
730
|
+
'Ruby AST-node merge candidate has ambiguous whitespace, comment, or marker ' \
|
|
731
|
+
'reconstruction boundaries.'
|
|
732
|
+
else
|
|
733
|
+
'Ruby AST-node merge candidate can be considered when owner-level fallback would be too blunt.'
|
|
734
|
+
end
|
|
697
735
|
}
|
|
698
736
|
]
|
|
699
737
|
}
|
|
@@ -815,7 +853,12 @@ module Ruby
|
|
|
815
853
|
{
|
|
816
854
|
severity: widened ? 'error' : 'info',
|
|
817
855
|
category: widened ? 'fallback_scope_widening_rejected' : 'fallback_scope_accepted',
|
|
818
|
-
message: widened
|
|
856
|
+
message: if widened
|
|
857
|
+
"Ruby fallback cannot widen from #{declared_scope} to #{requested_scope} without an " \
|
|
858
|
+
'explicit policy.'
|
|
859
|
+
else
|
|
860
|
+
'Ruby fallback scope is within the declared policy.'
|
|
861
|
+
end
|
|
819
862
|
}
|
|
820
863
|
]
|
|
821
864
|
}
|
|
@@ -956,7 +999,8 @@ module Ruby
|
|
|
956
999
|
{
|
|
957
1000
|
severity: 'info',
|
|
958
1001
|
category: 'ruby_rename_detection',
|
|
959
|
-
message: 'Ruby rename detection is explicit and reports clean same-parent method renames
|
|
1002
|
+
message: 'Ruby rename detection is explicit and reports clean same-parent method renames ' \
|
|
1003
|
+
'by normalized body hash.'
|
|
960
1004
|
}
|
|
961
1005
|
]
|
|
962
1006
|
end,
|
|
@@ -1061,7 +1105,8 @@ module Ruby
|
|
|
1061
1105
|
{
|
|
1062
1106
|
severity: 'info',
|
|
1063
1107
|
category: 'ruby_cross_container_method_move',
|
|
1064
|
-
message: 'Ruby detected same-signature method movement across containers while preserving
|
|
1108
|
+
message: 'Ruby detected same-signature method movement across containers while preserving ' \
|
|
1109
|
+
'destination order.'
|
|
1065
1110
|
}
|
|
1066
1111
|
]
|
|
1067
1112
|
end
|
|
@@ -1162,7 +1207,13 @@ module Ruby
|
|
|
1162
1207
|
execution = Array(replay_bundle[:reviewed_nested_executions]).find { |entry| entry[:family] == 'ruby' }
|
|
1163
1208
|
unless execution
|
|
1164
1209
|
return { ok: false,
|
|
1165
|
-
diagnostics: [
|
|
1210
|
+
diagnostics: [
|
|
1211
|
+
{
|
|
1212
|
+
severity: 'error',
|
|
1213
|
+
category: 'configuration_error',
|
|
1214
|
+
message: 'review replay bundle does not include a reviewed nested execution for ruby.'
|
|
1215
|
+
}
|
|
1216
|
+
], policies: [] }
|
|
1166
1217
|
end
|
|
1167
1218
|
|
|
1168
1219
|
merge_ruby_with_reviewed_nested_outputs(
|
|
@@ -1179,7 +1230,13 @@ module Ruby
|
|
|
1179
1230
|
execution = Array(review_state[:reviewed_nested_executions]).find { |entry| entry[:family] == 'ruby' }
|
|
1180
1231
|
unless execution
|
|
1181
1232
|
return { ok: false,
|
|
1182
|
-
diagnostics: [
|
|
1233
|
+
diagnostics: [
|
|
1234
|
+
{
|
|
1235
|
+
severity: 'error',
|
|
1236
|
+
category: 'configuration_error',
|
|
1237
|
+
message: 'review state does not include a reviewed nested execution for ruby.'
|
|
1238
|
+
}
|
|
1239
|
+
], policies: [] }
|
|
1183
1240
|
end
|
|
1184
1241
|
|
|
1185
1242
|
merge_ruby_with_reviewed_nested_outputs(
|
|
@@ -1196,7 +1253,9 @@ module Ruby
|
|
|
1196
1253
|
replay_bundle, import_error = Ast::Merge.import_review_replay_bundle_envelope(envelope)
|
|
1197
1254
|
if import_error
|
|
1198
1255
|
return { ok: false,
|
|
1199
|
-
diagnostics: [
|
|
1256
|
+
diagnostics: [
|
|
1257
|
+
{ severity: 'error', category: import_error[:category], message: import_error[:message] }
|
|
1258
|
+
], policies: [] }
|
|
1200
1259
|
end
|
|
1201
1260
|
|
|
1202
1261
|
merge_ruby_with_reviewed_nested_outputs_from_replay_bundle(
|
|
@@ -1212,7 +1271,9 @@ module Ruby
|
|
|
1212
1271
|
review_state, import_error = Ast::Merge.import_conformance_manifest_review_state_envelope(envelope)
|
|
1213
1272
|
if import_error
|
|
1214
1273
|
return { ok: false,
|
|
1215
|
-
diagnostics: [
|
|
1274
|
+
diagnostics: [
|
|
1275
|
+
{ severity: 'error', category: import_error[:category], message: import_error[:message] }
|
|
1276
|
+
], policies: [] }
|
|
1216
1277
|
end
|
|
1217
1278
|
|
|
1218
1279
|
merge_ruby_with_reviewed_nested_outputs_from_review_state(
|
|
@@ -1515,7 +1576,9 @@ module Ruby
|
|
|
1515
1576
|
unsupported_lines = ruby_tslp_unsupported_top_level_lines(source, process_analysis)
|
|
1516
1577
|
unless unsupported_lines.empty?
|
|
1517
1578
|
return unsupported_feature_result(
|
|
1518
|
-
"ruby-merge can only merge TSLP-record-backed top-level Ruby declarations and imports; #{role} has
|
|
1579
|
+
"ruby-merge can only merge TSLP-record-backed top-level Ruby declarations and imports; #{role} has " \
|
|
1580
|
+
"unsupported top-level content on line(s) #{unsupported_lines.join(', ')}. Use a native Ruby provider " \
|
|
1581
|
+
'for native Ruby merging, or report missing Ruby process records to tree-sitter-language-pack.'
|
|
1519
1582
|
)
|
|
1520
1583
|
end
|
|
1521
1584
|
|
|
@@ -1966,13 +2029,16 @@ module Ruby
|
|
|
1966
2029
|
severity: 'warning',
|
|
1967
2030
|
category: 'ruby_method_shadowing',
|
|
1968
2031
|
path: "#{entry[:owner_path]}/methods/#{entry[:method_signature]}",
|
|
1969
|
-
message: "Ruby method #{entry[:method_signature]} is defined #{entry[:shadowed_count] + 1} times in
|
|
2032
|
+
message: "Ruby method #{entry[:method_signature]} is defined #{entry[:shadowed_count] + 1} times in " \
|
|
2033
|
+
"#{entry[:owner_path]}; the last definition shadows earlier definitions."
|
|
1970
2034
|
}
|
|
1971
2035
|
end
|
|
1972
2036
|
end
|
|
1973
2037
|
|
|
1974
2038
|
def direct_method_shadowing(declaration_entry)
|
|
1975
|
-
grouped = direct_body_method_entries(declaration_entry[:text])
|
|
2039
|
+
grouped = direct_body_method_entries(declaration_entry[:text])
|
|
2040
|
+
.each_with_index
|
|
2041
|
+
.group_by do |(method_entry, _index)|
|
|
1976
2042
|
method_entry[:signature]
|
|
1977
2043
|
end
|
|
1978
2044
|
|
|
@@ -2097,9 +2163,8 @@ module Ruby
|
|
|
2097
2163
|
template_match = template_text.match(/\A(\s*[A-Z]\w*\s*=\s*)\[(.*)\]\z/)
|
|
2098
2164
|
destination_match = destination_text.match(/\A(\s*[A-Z]\w*\s*=\s*)\[(.*)\]\z/)
|
|
2099
2165
|
unless template_match && destination_match
|
|
2100
|
-
return merge_percent_array_constant_text(template_text,
|
|
2101
|
-
|
|
2102
|
-
destination_text)
|
|
2166
|
+
return merge_percent_array_constant_text(template_text, destination_text) ||
|
|
2167
|
+
merge_multiline_array_constant_text(template_text, destination_text)
|
|
2103
2168
|
end
|
|
2104
2169
|
|
|
2105
2170
|
destination_elements = split_ruby_array_elements(destination_match[2])
|
|
@@ -2276,7 +2341,11 @@ module Ruby
|
|
|
2276
2341
|
if declaration
|
|
2277
2342
|
start_index = pending_comments.first || index
|
|
2278
2343
|
finish_index = ruby_block_finish_index(lines, index)
|
|
2279
|
-
address = declaration[:kind] == 'def'
|
|
2344
|
+
address = if declaration[:kind] == 'def'
|
|
2345
|
+
"/methods/#{declaration[:name]}"
|
|
2346
|
+
else
|
|
2347
|
+
"/declarations/#{declaration[:name]}"
|
|
2348
|
+
end
|
|
2280
2349
|
owner = {
|
|
2281
2350
|
region_id: "#{declaration[:kind] == 'def' ? 'method' : 'declaration'}:#{declaration[:name]}",
|
|
2282
2351
|
region_kind: 'owner',
|
|
@@ -2290,8 +2359,9 @@ module Ruby
|
|
|
2290
2359
|
declaration_span: source_report_line_span(index, finish_index),
|
|
2291
2360
|
content: source_report_region_content(lines, start_index, finish_index)
|
|
2292
2361
|
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2362
|
+
if %w[class module].include?(declaration[:kind])
|
|
2363
|
+
owner[:child_regions] = container_child_source_regions(lines, declaration, index, finish_index)
|
|
2364
|
+
end
|
|
2295
2365
|
attached_comments = source_attached_comment_regions_for_report(
|
|
2296
2366
|
lines: lines,
|
|
2297
2367
|
start_index: start_index,
|
|
@@ -2389,6 +2459,7 @@ module Ruby
|
|
|
2389
2459
|
RubyHashPair = Struct.new(:key, :key_source, :delimiter, :value, keyword_init: true)
|
|
2390
2460
|
RubyScalarNode = Struct.new(:source, keyword_init: true)
|
|
2391
2461
|
|
|
2462
|
+
# Projects Ruby hash literals into source-preserving merge nodes.
|
|
2392
2463
|
class RubyHashLiteralProjector
|
|
2393
2464
|
def initialize(source)
|
|
2394
2465
|
@source = source.to_s
|
|
@@ -3139,6 +3210,10 @@ module Ruby
|
|
|
3139
3210
|
:collect_ruby_declaration_entries,
|
|
3140
3211
|
:unsupported_feature_result
|
|
3141
3212
|
)
|
|
3213
|
+
# rubocop:enable Style/MultilineBlockChain
|
|
3214
|
+
# rubocop:enable Metrics/ModuleLength, Metrics/PerceivedComplexity
|
|
3215
|
+
# rubocop:enable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
3216
|
+
# rubocop:enable Metrics/AbcSize, Metrics/BlockLength, Metrics/BlockNesting
|
|
3142
3217
|
end
|
|
3143
3218
|
end
|
|
3144
3219
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.1.
|
|
4
|
+
version: 7.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -43,28 +43,28 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 7.1.
|
|
46
|
+
version: 7.1.4
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 7.1.
|
|
53
|
+
version: 7.1.4
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: tree_haver
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 7.1.
|
|
60
|
+
version: 7.1.4
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 7.1.
|
|
67
|
+
version: 7.1.4
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: version_gem
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,20 +91,20 @@ dependencies:
|
|
|
91
91
|
requirements:
|
|
92
92
|
- - "~>"
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: '
|
|
94
|
+
version: '3.0'
|
|
95
95
|
- - ">="
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version:
|
|
97
|
+
version: 3.0.7
|
|
98
98
|
type: :development
|
|
99
99
|
prerelease: false
|
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
|
102
102
|
- - "~>"
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '
|
|
104
|
+
version: '3.0'
|
|
105
105
|
- - ">="
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version:
|
|
107
|
+
version: 3.0.7
|
|
108
108
|
- !ruby/object:Gem::Dependency
|
|
109
109
|
name: bundler-audit
|
|
110
110
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -182,7 +182,7 @@ dependencies:
|
|
|
182
182
|
version: '3.2'
|
|
183
183
|
- - ">="
|
|
184
184
|
- !ruby/object:Gem::Version
|
|
185
|
-
version: 3.2.
|
|
185
|
+
version: 3.2.2
|
|
186
186
|
type: :development
|
|
187
187
|
prerelease: false
|
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -192,7 +192,7 @@ dependencies:
|
|
|
192
192
|
version: '3.2'
|
|
193
193
|
- - ">="
|
|
194
194
|
- !ruby/object:Gem::Version
|
|
195
|
-
version: 3.2.
|
|
195
|
+
version: 3.2.2
|
|
196
196
|
- !ruby/object:Gem::Dependency
|
|
197
197
|
name: kettle-test
|
|
198
198
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -202,7 +202,7 @@ dependencies:
|
|
|
202
202
|
version: '2.0'
|
|
203
203
|
- - ">="
|
|
204
204
|
- !ruby/object:Gem::Version
|
|
205
|
-
version: 2.0.
|
|
205
|
+
version: 2.0.20
|
|
206
206
|
type: :development
|
|
207
207
|
prerelease: false
|
|
208
208
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -212,7 +212,7 @@ dependencies:
|
|
|
212
212
|
version: '2.0'
|
|
213
213
|
- - ">="
|
|
214
214
|
- !ruby/object:Gem::Version
|
|
215
|
-
version: 2.0.
|
|
215
|
+
version: 2.0.20
|
|
216
216
|
- !ruby/object:Gem::Dependency
|
|
217
217
|
name: turbo_tests2
|
|
218
218
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -222,7 +222,7 @@ dependencies:
|
|
|
222
222
|
version: '3.2'
|
|
223
223
|
- - ">="
|
|
224
224
|
- !ruby/object:Gem::Version
|
|
225
|
-
version: 3.2.
|
|
225
|
+
version: 3.2.6
|
|
226
226
|
type: :development
|
|
227
227
|
prerelease: false
|
|
228
228
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -232,7 +232,7 @@ dependencies:
|
|
|
232
232
|
version: '3.2'
|
|
233
233
|
- - ">="
|
|
234
234
|
- !ruby/object:Gem::Version
|
|
235
|
-
version: 3.2.
|
|
235
|
+
version: 3.2.6
|
|
236
236
|
- !ruby/object:Gem::Dependency
|
|
237
237
|
name: ruby-progressbar
|
|
238
238
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -276,7 +276,7 @@ dependencies:
|
|
|
276
276
|
version: '2.0'
|
|
277
277
|
- - ">="
|
|
278
278
|
- !ruby/object:Gem::Version
|
|
279
|
-
version: 2.0.
|
|
279
|
+
version: 2.0.12
|
|
280
280
|
type: :development
|
|
281
281
|
prerelease: false
|
|
282
282
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -286,7 +286,7 @@ dependencies:
|
|
|
286
286
|
version: '2.0'
|
|
287
287
|
- - ">="
|
|
288
288
|
- !ruby/object:Gem::Version
|
|
289
|
-
version: 2.0.
|
|
289
|
+
version: 2.0.12
|
|
290
290
|
description: "☯️ Tree-sitter-backed Ruby family substrate for Structured Merge."
|
|
291
291
|
email:
|
|
292
292
|
- floss@galtzo.com
|
|
@@ -317,10 +317,10 @@ licenses:
|
|
|
317
317
|
- PolyForm-Small-Business-1.0.0
|
|
318
318
|
metadata:
|
|
319
319
|
homepage_uri: https://structuredmerge.org
|
|
320
|
-
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.
|
|
321
|
-
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.
|
|
320
|
+
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.4
|
|
321
|
+
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.4/CHANGELOG.md
|
|
322
322
|
bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
323
|
-
documentation_uri: https://www.rubydoc.info/gems/ruby-merge/7.1.
|
|
323
|
+
documentation_uri: https://www.rubydoc.info/gems/ruby-merge/7.1.4
|
|
324
324
|
funding_uri: https://github.com/sponsors/pboling
|
|
325
325
|
wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
326
326
|
news_uri: https://www.railsbling.com/tags/ruby-merge
|
metadata.gz.sig
CHANGED
|
Binary file
|