Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 30, 2019
2 parents 93cf62a + 742f4bc commit abea1d5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
*
* @see <a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html">Keywords substitution in Subversion</a>
* @since 0.3
* @todo #743:30min Nested classes should have since tag. Implement check to
* validate if nested classes javadoc have a valid since tag. After the
* implementation add JavadocTagsCheck to checks.xml and ChecksTest (removed
* because now the test fails).
*/
public final class JavadocTagsCheck extends AbstractCheck {

Expand Down Expand Up @@ -111,21 +107,19 @@ public void init() {

@Override
public void visitToken(final DetailAST ast) {
if (ast.getParent() == null) {
final String[] lines = this.getLines();
final int start = ast.getLineNo();
final int cstart = JavadocTagsCheck.findCommentStart(lines, start);
final int cend = JavadocTagsCheck.findCommentEnd(lines, start);
if (cend > cstart && cstart >= 0) {
for (final String tag : this.prohibited) {
this.findProhibited(lines, start, cstart, cend, tag);
}
for (final String tag : this.tags.keySet()) {
this.matchTagFormat(lines, cstart, cend, tag);
}
} else {
this.log(0, "Problem finding class/interface comment");
final String[] lines = this.getLines();
final int start = ast.getLineNo();
final int cstart = JavadocTagsCheck.findCommentStart(lines, start);
final int cend = JavadocTagsCheck.findCommentEnd(lines, start);
if (cend > cstart && cstart >= 0) {
for (final String tag : this.prohibited) {
this.findProhibited(lines, start, cstart, cend, tag);
}
for (final String tag : this.tags.keySet()) {
this.matchTagFormat(lines, cstart, cend, tag);
}
} else {
this.log(0, "Problem finding class/interface comment");
}
}

Expand Down Expand Up @@ -252,7 +246,7 @@ private List<Integer> findTagLineNum(final String[] lines, final int start,
for (int pos = start; pos <= end; pos += 1) {
final String line = lines[pos];
if (line.contains(String.format("@%s ", tag))) {
if (!line.startsWith(prefix)) {
if (!line.trim().startsWith(prefix.trim())) {
this.log(
start + pos + 1,
"Line with ''@{0}'' does not start with a ''{1}''",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
<module name="com.qulice.checkstyle.FinalSemicolonInTryWithResourcesCheck"/>
<module name="com.qulice.checkstyle.JavadocEmptyLineCheck"/>
<module name="com.qulice.checkstyle.DiamondOperatorCheck"/>
<module name="com.qulice.checkstyle.JavadocTagsCheck"/>
</module>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public final class ChecksTest {
"NonStaticMethodCheck",
"ConstantUsageCheck",
"JavadocEmptyLineCheck",
"JavadocTagsCheck",
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public final String UPPERCASE() {

/**
* ValidInnerHtml example class having the abbreviation in camelcase.
* @since 1.0
*/
public class ValidInnerHtml {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public class ValidAbbreviationAsWordInNameIT {
/**
* Valid name on inner class, because the IT abbreviation is allowed.
* @since 1.0
*/
class ValidInnerIT {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ public static void innerClassUsage() {

/**
* Simple interface, used as wrapper.
* @since 1.0
*/
interface SimpleInterface {

/**
* Inner class with generic parameter.
* @param <E> generic parameter
* @since 1.0
*/
final class InnerClass<E> implements SimpleInterface {

Expand Down

1 comment on commit abea1d5

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on abea1d5 Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 743-bb004e21 disappeared from qulice-checkstyle/src/main/java/com/qulice/checkstyle/JavadocTagsCheck.java, that's why I closed #1004. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.