Search in sources :

Example 11 with TextBlock

use of com.puppycrawl.tools.checkstyle.api.TextBlock in project checkstyle by checkstyle.

the class JavadocMethodCheck method processAST.

@Override
protected final void processAST(DetailAST ast) {
    final Scope theScope = calculateScope(ast);
    if (shouldCheck(ast, theScope)) {
        final FileContents contents = getFileContents();
        final TextBlock textBlock = contents.getJavadocBefore(ast.getLineNo());
        if (textBlock == null) {
            if (!isMissingJavadocAllowed(ast)) {
                log(ast, MSG_JAVADOC_MISSING);
            }
        } else {
            checkComment(ast, textBlock);
        }
    }
}
Also used : FileContents(com.puppycrawl.tools.checkstyle.api.FileContents) Scope(com.puppycrawl.tools.checkstyle.api.Scope) TextBlock(com.puppycrawl.tools.checkstyle.api.TextBlock)

Example 12 with TextBlock

use of com.puppycrawl.tools.checkstyle.api.TextBlock in project checkstyle by checkstyle.

the class SuppressWithNearbyCommentFilter method tagSuppressions.

/**
     * Appends the suppressions in a collection of comments to the full
     * set of suppression tags.
     * @param comments the set of comments.
     */
private void tagSuppressions(Collection<TextBlock> comments) {
    for (final TextBlock comment : comments) {
        final int startLineNo = comment.getStartLineNo();
        final String[] text = comment.getText();
        tagCommentLine(text[0], startLineNo);
        for (int i = 1; i < text.length; i++) {
            tagCommentLine(text[i], startLineNo + i);
        }
    }
}
Also used : TextBlock(com.puppycrawl.tools.checkstyle.api.TextBlock)

Aggregations

TextBlock (com.puppycrawl.tools.checkstyle.api.TextBlock)12 FileContents (com.puppycrawl.tools.checkstyle.api.FileContents)6 DetailAST (com.puppycrawl.tools.checkstyle.api.DetailAST)1 Scope (com.puppycrawl.tools.checkstyle.api.Scope)1 HashSet (java.util.HashSet)1 List (java.util.List)1