gnodet-bot commented on code in PR #1214:
URL: 
https://github.com/apache/maven-plugin-tools/pull/1214#discussion_r4462819934


##########
maven-plugin-tools-generators/src/main/resources/help-class-source.vm:
##########
@@ -390,6 +408,29 @@ public class HelpMojo
         int lineIndent = getIndentLevel( line );
         StringBuilder buf = new StringBuilder( 256 );
 
+        // Preserve leading spaces in preformatted descriptions instead of 
treating them as word separators.
+        if ( lineIndent < line.length() && line.charAt( lineIndent ) == ' ' )

Review Comment:
   ⚠️ **Same dead-code guard as `help-class-source-v4.vm`** — `== ' '` should 
be `== '\u00A0'`.
   
   ```suggestion
           if ( lineIndent < line.length() && line.charAt( lineIndent ) == 
'\u00A0' )
   ```



##########
maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm:
##########
@@ -400,6 +418,29 @@ public class HelpMojo
         int lineIndent = getIndentLevel( line );
         StringBuilder buf = new StringBuilder( 256 );
 
+        // Preserve leading spaces in preformatted descriptions instead of 
treating them as word separators.
+        if ( lineIndent < line.length() && line.charAt( lineIndent ) == ' ' )

Review Comment:
   ⚠️ **Dead-code guard: `== ' '` (U+0020) should be `== '\u00A0'` (NBSP)**
   
   The early-exit branch is intended to identify NBSP-encoded preformatted 
lines (spaces in `<pre>` blocks replaced with U+00A0 by the converter). But 
`getIndentLevel()` counts leading tab characters, so `line.charAt(lineIndent)` 
is the **first non-tab character** — which for NBSP-encoded content is U+00A0, 
never plain U+0020.
   
   As a result, this branch never fires. The code is functionally correct 
because the existing token loop (unchanged) already decodes NBSP char-by-char 
in its `for (int j = 0; j < token.length(); j++)` loop. But the early-exit 
branch is dead code with a misleading comment.
   
   ```suggestion
           if ( lineIndent < line.length() && line.charAt( lineIndent ) == 
'\u00A0' )
   ```
   
   Same issue exists in `help-class-source.vm`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to