Skip to content

Commit 4d6973a

Browse files
committed
fix(codemod): description handler stops at next field declaration
Added negative lookahead to prevent the description: handler from consuming subsequent field declarations (e.g. implementation_notes:) as description body content. Result: 260/289 deep equivalent
1 parent fbd3ace commit 4d6973a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/interscript/isc/codemod.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ def convert_metadata_block
239239
end
240240
end
241241
@out << " }"
242-
elsif @scanner.scan(/(?:\A|\n)([ \t]+)description[ \t]*:[ \t]*\n[ \t]+/)
242+
elsif @scanner.scan(/(?:\A|\n)([ \t]+)description[ \t]*:[ \t]*\n(?![ \t]*[A-Za-z_]\w*[ \t]*:)(?![ \t]*\})[ \t]+/)
243243
# `description:` with unquoted value on subsequent indented line(s).
244+
# Negative lookahead prevents consuming next field (e.g. implementation_notes).
244245
indent = @scanner[1]
245246
@out << "\n#{indent}description { "
246247
until @scanner.eos?

0 commit comments

Comments
 (0)