Skip to content

Commit

Permalink
Issue checkstyle#6295: Increase mutation coverage for javadoc profile…
Browse files Browse the repository at this point in the history
… to 100%
  • Loading branch information
Vyom-Yadav committed Jul 1, 2022
1 parent b87a6c0 commit 8cf7036
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 43 deletions.
11 changes: 0 additions & 11 deletions .ci/pitest-suppressions/pitest-javadoc-suppressions.xml

This file was deleted.

10 changes: 2 additions & 8 deletions .ci/pitest-survival-check-html.sh
Expand Up @@ -58,7 +58,8 @@ pitest-annotation|pitest-design \
|pitest-meta \
|pitest-tree-walker \
|pitest-utils \
|pitest-java-ast-visitor)
|pitest-java-ast-visitor \
|pitest-javadoc)
declare -a ignoredItems=();
checkPitestReport ignoredItems
;;
Expand Down Expand Up @@ -143,13 +144,6 @@ pitest-indentation)
checkPitestReport ignoredItems
;;

pitest-javadoc)
declare -a ignoredItems=(
"TagParser.java.html:<td class='covered'><pre><span class='survived'> while (column &#60; currentLineLength</span></pre></td></tr>"
);
checkPitestReport ignoredItems
;;

pitest-coding-1)
declare -a ignoredItems=(
"UnnecessaryParenthesesCheck.java.html:<td class='covered'><pre><span class='survived'> || parent.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) {</span></pre></td></tr>"
Expand Down
Expand Up @@ -107,7 +107,7 @@ else if (isTag(text, position)) {
position = parseTag(text, lineNo, nLines, position);
}
else {
position = getNextCharPos(text, position);
position = getNextPoint(text, position);
}
position = findChar(text, '<', position);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ private static Point skipHtmlComment(String[] text, Point fromPoint) {
toPoint = findChar(text, '>', toPoint);
while (toPoint.getLineNo() < text.length && !text[toPoint.getLineNo()]
.substring(0, toPoint.getColumnNo() + 1).endsWith("-->")) {
toPoint = findChar(text, '>', getNextCharPos(text, toPoint));
toPoint = findChar(text, '>', getNextPoint(text, toPoint));
}
return toPoint;
}
Expand All @@ -241,45 +241,28 @@ private static Point findChar(String[] text, char character, Point from) {
Point curr = new Point(from.getLineNo(), from.getColumnNo());
while (curr.getLineNo() < text.length
&& text[curr.getLineNo()].charAt(curr.getColumnNo()) != character) {
curr = getNextCharPos(text, curr);
curr = getNextPoint(text, curr);
}

return curr;
}

/**
* Returns position of next comment character, skips
* whitespaces and asterisks.
* Increments column number to be examined, moves onto the next line when no
* more characters are available.
*
* @param text to search.
* @param from location to search from
* @return location of the next character.
* @return next point to be examined
*/
private static Point getNextCharPos(String[] text, Point from) {
private static Point getNextPoint(String[] text, Point from) {
int line = from.getLineNo();
int column = from.getColumnNo() + 1;
while (line < text.length && column >= text[line].length()) {
// go to the next line
line++;
column = 0;
if (line < text.length) {
// skip beginning spaces and stars
final String currentLine = text[line];
final int currentLineLength = currentLine.length();
while (column < currentLineLength
&& (Character.isWhitespace(currentLine.charAt(column))
|| currentLine.charAt(column) == '*')) {
column++;
if (column < currentLineLength
&& currentLine.charAt(column - 1) == '*'
&& currentLine.charAt(column) == '/') {
// this is end of comment
column = currentLineLength;
}
}
}
}

return new Point(line, column);
}

Expand Down

0 comments on commit 8cf7036

Please sign in to comment.