Package com.puppycrawl.tools.checkstyle.api

Examples of com.puppycrawl.tools.checkstyle.api.FileContents


      violations.add( aLineno );
    }

    private FileContents content(List<String> aLines) {
      FileText fileText = FileText.fromLines( new File( "" ), aLines );
      return new FileContents( fileText );
    }
View Full Code Here


    Assert.assertFalse( suppressor.shouldSuppress( 1, 18, 0, 20 ) );
  }

  private FileContents content(String string) {
    FileText fileText = FileText.fromLines( new File( "" ), Arrays.asList( string ) );
    return new FileContents( fileText );
  }
View Full Code Here

            referenced.add(aAST.getText());
        }
    }

    protected void processJavaDocLinkParameters( DetailAST aAST ) {
        final FileContents contents = getFileContents();
        final int lineNo = aAST.getLineNo();
        final TextBlock cmt = contents.getJavadocBefore(lineNo);
        if (cmt != null) {
            final JavadocTags tags = JavaDocUtil.getJavadocTags(cmt, JavadocUtils.JavadocTagType.ALL);
            for (final JavadocTag tag : tags.getValidTags()) {
                processJavaDocTag(tag);
            }
View Full Code Here

        }

        try {
            getMessageDispatcher().fireFileStarted(fileName);
            final String[] lines = Utils.getLines(fileName, getCharset());
            final FileContents contents = new FileContents(fileName, lines);
            final DetailAST rootAST = TreeWalker.parse(contents);
            walk(rootAST, contents);
        }
        catch (FileNotFoundException fnfe) {
            Utils.getExceptionLogger()
View Full Code Here

     */
    public static DetailAST parseFile(String aFileName)
        throws IOException, ANTLRException
    {
        final String[] lines = Utils.getLines(aFileName);
        final FileContents contents = new FileContents(aFileName, lines);
        return TreeWalker.parse(contents);
    }
View Full Code Here

            return true;        // A special event.
        }

        // Lazy update. If the first event for the current file, update file
        // contents and tag suppressions
        final FileContents currentContents = FileContentsHolder.getContents();
        if (currentContents == null) {
            // we have no contents, so we can not filter.
            // TODO: perhaps we should notify user somehow?
            return true;
        }
View Full Code Here

     * sorts the list.
     */
    private void tagSuppressions()
    {
        mTags.clear();
        final FileContents contents = getFileContents();
        if (mCheckCPP) {
            tagSuppressions(contents.getCppComments().values());
        }
        if (mCheckC) {
            final Collection cComments = contents.getCComments().values();
            final Iterator iter = cComments.iterator();
            while (iter.hasNext()) {
                final Collection element = (Collection) iter.next();
                tagSuppressions(element);
            }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void beginTree(DetailAST aRootAST)
    {
        final FileContents contents = getFileContents();
        checkCppComments(contents);
        checkBadComments(contents);
    }
View Full Code Here

    /** {@inheritDoc} */
    public void visitToken(DetailAST aAST)
    {
        if (shouldCheck(aAST)) {
            final FileContents contents = getFileContents();
            final TextBlock cmt =
                contents.getJavadocBefore(aAST.getLineNo());

            checkComment(aAST, cmt);
        }
    }
View Full Code Here

                openingBrace.findFirstToken(TokenTypes.RCURLY);
            int length =
                closingBrace.getLineNo() - openingBrace.getLineNo() + 1;

            if (!mCountEmpty) {
                final FileContents contents = getFileContents();
                final int lastLine = closingBrace.getLineNo();
                for (int i = openingBrace.getLineNo() - 1; i < lastLine; i++) {
                    if (contents.lineIsBlank(i) || contents.lineIsComment(i)) {
                        length--;
                    }
                }
            }
            if (length > mMax) {
View Full Code Here

TOP

Related Classes of com.puppycrawl.tools.checkstyle.api.FileContents

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.