Issue #17281: Add new DescriptionMacro#17278
Conversation
|
Where is the issue for this PR? |
There, fixed it |
|
Issue should be in commit prefix |
884d023 to
7a27b16
Compare
Done |
b5fed51 to
914cd04
Compare
|
GitHub, generate website |
914cd04 to
44b959a
Compare
|
GitHub, generate website |
44b959a to
9534315
Compare
|
@SteLeo1602 I wanted to debug the new DescriptionMacro.java file to better understand the code, do you know any ways to debug it? |
Just debug launch the XdocsPagesTest.java and see how DescriptionMacro gets the description and prints it out. |
9534315 to
3b59352
Compare
3b59352 to
15d99c2
Compare
15d99c2 to
e294f21
Compare
Zopsss
left a comment
There was a problem hiding this comment.
Sorry for the delay, I was having some difficulties with my IntelliJ.
| else if (index > 1 | ||
| && (previousProcessedLine.contains("<pre") | ||
| || !previousProcessedLine.startsWith(INDENT_LEVEL_8))) { | ||
|
|
||
| final String currentLineWithPreservedIndent = moduleDescriptionLinesSplit[index] | ||
| .substring(1); | ||
| processedLine = NEWLINE + currentLineWithPreservedIndent; | ||
| } |
There was a problem hiding this comment.
Is this else if statement only for handling code blocks? I debugged the code, and this else if statement was used only when we encountered code blocks.
If yes, then the currentLineWithPreservedIndent variable name doesn't make much sense. There is no indentation for code blocks:
checkstyle/src/site/xdoc/checks/annotation/annotationlocation.xml
Lines 30 to 32 in e294f21
currentLineWithPreservedIndent should be renamed to currentCodeBlockLine or something similar, ask AI for better naming, I'm bad at naming things :p
There was a problem hiding this comment.
This else if statement is for any block that is under the <pre></pre> tags which work to preserve the indentation. This might be mostly for code blocks, but not always, as I've only implemented this macro for 2 checks. So far, in this check example, there is only 1 line of code with no indent which is just an occasion, but for more complex code examples, there can be different levels of indentation just like in the actual java code which has to be accounted and not hard-given the identical indentation like for the rest of blocks.
There was a problem hiding this comment.
I checked all module's description and mostly all of them had <pre> tag followed by <code> tag, there were <pre> tags without <code> but they weren't in module's description, at least I couldn't find such case.
Anyways, this conversation is Resolved 👍🏻
| /** | ||
| * Gets the start index of the parent subsection in module's JavaDoc. | ||
| * | ||
| * @param moduleJavadoc javadoc of module. | ||
| * @return start index of parent subsection. | ||
| */ | ||
| private static int getParentSectionStartIndex(DetailNode moduleJavadoc) { |
There was a problem hiding this comment.
This method is used when the module doesn't have any properties, so we find the following part in module's javadoc:
* <p>
* Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker}
* </p>and return it's index.
The description is little confusing if you don't know what method does, so it should be simplified to something like:
Gets the starting index of the "Parent is" paragraph in module's javadoc.
|
spotbug CI failure is not related to the PR so it can be ignored |
fad4513 to
04c17cd
Compare
04c17cd to
345e556
Compare
|
GitHub, generate website |
Issue: #17281