Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import com.puppycrawl.tools.checkstyle.utils.JavadocUtil;
import io.papermc.checkstyle.Util;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -30,6 +32,7 @@ record ParamDesc(DetailNode node, int startCol) {
final List<ParamDesc> params = new ArrayList<>();
int maxColumn = -1;
DetailNode child = detailNode.getFirstChild();
final Set<Integer> visitedLines = new HashSet<>();
for (final DetailNode javadocBlock : JavadocUtil.getAllNodesOfType(detailNode, JavadocCommentsTokenTypes.JAVADOC_BLOCK_TAG)) {
final DetailNode paramBlock = JavadocUtil.findFirstToken(javadocBlock, JavadocCommentsTokenTypes.PARAM_BLOCK_TAG);
if (paramBlock == null) {
Expand All @@ -41,6 +44,9 @@ record ParamDesc(DetailNode node, int startCol) {
}
// iterate over all text nodes (multiline)
for (final DetailNode textNode : JavadocUtil.getAllNodesOfType(paramDescription, JavadocCommentsTokenTypes.TEXT)) {
if (!visitedLines.add(textNode.getLineNumber())) {
continue;
}
final Matcher matcher = SPACE_PREFIX.matcher(textNode.getText());
int paramDescColNum = textNode.getColumnNumber();
if (matcher.find()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,26 @@ public void method_multiline(String a, String superLongParamName) {
public void method_multiline_correct(String a, String superLongParamName) {
}

/**
* A method that does something
*
* @param a this is a description
* with a {@link #method(String, String)} link tag
* @param superLongParamName a description
* blabla
*/
public void method_multiline_correct_with_link(String a, String superLongParamName) {
}

/**
* A method where line 2 starts with a link tag
*
* @param a this is a description
* {@link #method(String, String)} is at line start
* @param superLongParamName a description
* blabla
*/
public void method_line2_starts_with_link(String a, String superLongParamName) {
}

}
Loading