Package com.puppycrawl.tools.checkstyle.api

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


    {
        final Set<Entry<File, Set<Object>>> fls = aFileMap.entrySet();

        for (Entry<File, Set<Object>> entry : fls) {
            final File currentFile = entry.getKey();
            final MessageDispatcher dispatcher = getMessageDispatcher();
            final String path = currentFile.getPath();
            dispatcher.fireFileStarted(path);
            final Set<Object> currentKeys = entry.getValue();

            // Clone the keys so that they are not lost
            final Set<Object> keysClone = Sets.newHashSet(aKeys);
            keysClone.removeAll(currentKeys);

            // Remaining elements in the key set are missing in the current file
            if (!keysClone.isEmpty()) {
                for (Object key : keysClone) {
                    log(0, "translation.missingKey", key);
                }
            }
            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here


    /** {@inheritDoc} */
    public void process(List<File> aFiles)
    {
        final List<File> files = filter(aFiles);
        final MessageDispatcher dispatcher = getMessageDispatcher();
        for (final File file : files) {
            final String path = file.getPath();
            dispatcher.fireFileStarted(path);
            RandomAccessFile randomAccessFile = null;
            try {
                randomAccessFile = new RandomAccessFile(file, "r");
                if (!endsWithNewline(randomAccessFile)) {
                    log(0, "noNewlineAtEOF", path);
                }
            }
            catch (final IOException e) {
                ///CLOVER:OFF
                logIOException(e);
                ///CLOVER:ON
            }
            finally {
                if (randomAccessFile != null) {
                    try {
                        randomAccessFile.close();
                    }
                    catch (final IOException e) {
                        ///CLOVER:OFF
                        logIOException(e);
                        ///CLOVER:ON
                    }
                }
            }
            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

    /** {@inheritDoc} */
    public void process(List<File> aFiles)
    {

        final MessageDispatcher msgDispatcher = getMessageDispatcher();
        final RegexpHeaderChecker regexpHeaderChecker =
            new RegexpHeaderChecker(
                    mHeaderInfo, new FileSetCheckViolationMonitor());
        final List<File> files = filter(aFiles);
        for (final File file : files) {
            final String path = file.getPath();
            msgDispatcher.fireFileStarted(path);
            try {
                final String[] lines = Utils.getLines(path);
                regexpHeaderChecker.checkLines(lines);
            }
            catch (IOException ex) {
                log(0, "unable to open file: " + ex);
            }
            fireErrors(path);
            msgDispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

    {
        final List<File> javaFiles = filter(aFiles);
        final Set<File> directories = getParentDirs(javaFiles);
        for (File dir : directories) {
            // Check for the preferred file.
            final MessageDispatcher dispatcher = getMessageDispatcher();
            final File packageInfo = new File(dir, "package-info.java");
            final File packageHtml = new File(dir, "package.html");
            final String path;

            if (packageInfo.exists()) {
                path = packageInfo.getPath();
                dispatcher.fireFileStarted(path);
                if (packageHtml.exists()) {
                    log(0, "javadoc.legacyPackageHtml");
                }
            }
            else if (mAllowLegacy && packageHtml.exists()) {
                path = packageHtml.getPath();
                dispatcher.fireFileStarted(path);
            }
            else {
                path = packageInfo.getPath();
                dispatcher.fireFileStarted(path);
                log(0, "javadoc.packageInfo");
            }
            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

        final int len = mFiles.size();
        for (int i = 0; i < len; i++) {

            final String path = mFiles.get(i).getPath();
            getMessageCollector().reset();
            final MessageDispatcher dispatcher = getMessageDispatcher();
            dispatcher.fireFileStarted(path);

            for (int j = 0; j <= i; j++) {
                findDuplicatesInFiles(i, j);
            }

            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

    /** {@inheritDoc} */
    public void process(File[] aFiles)
    {

        final MessageDispatcher msgDispatcher = getMessageDispatcher();
        final RegexpHeaderChecker regexpHeaderChecker =
            new RegexpHeaderChecker(
                    mHeaderInfo, new FileSetCheckViolationMonitor());
        File[] files = filter(aFiles);
        for (int i = 0; i < files.length; i++) {
            final File file = files[i];
            final String path = file.getPath();
            msgDispatcher.fireFileStarted(path);
            try {
                String[] lines = Utils.getLines(path);
                regexpHeaderChecker.checkLines(lines);
            }
            catch (IOException ex) {
                log(0, "unable to open file: " + ex);
            }
            fireErrors(path);
            msgDispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

        final File[] javaFiles = filter(aFiles);
        final Set directories = getParentDirs(javaFiles);
        for (final Iterator it = directories.iterator(); it.hasNext();) {
            final File dir = (File) it.next();
            final File packageHtml = new File(dir, "package.html");
            final MessageDispatcher dispatcher = getMessageDispatcher();
            final String path = packageHtml.getPath();
            dispatcher.fireFileStarted(path);
            if (!packageHtml.exists()) {
                log(0, "javadoc.packageHtml");
                fireErrors(path);
            }
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

        final int len = mFiles.length;
        for (int i = 0; i < len; i++) {

            final String path = mFiles[i].getPath();
            getMessageCollector().reset();
            final MessageDispatcher dispatcher = getMessageDispatcher();
            dispatcher.fireFileStarted(path);

            for (int j = 0; j <= i; j++) {
                findDuplicatesInFiles(i, j);
            }

            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

        final Set fls = aFileMap.entrySet();

        for (final Iterator iter = fls.iterator(); iter.hasNext();) {
            final Map.Entry entry = (Map.Entry) iter.next();
            final File currentFile = (File) entry.getKey();
            final MessageDispatcher dispatcher = getMessageDispatcher();
            final String path = currentFile.getPath();
            dispatcher.fireFileStarted(path);
            final Set currentKeys = (Set) entry.getValue();

            // Clone the keys so that they are not lost
            final Set keysClone = new HashSet(aKeys);
            keysClone.removeAll(currentKeys);

            // Remaining elements in the key set are missing in the current file
            if (!keysClone.isEmpty()) {
                for (final Iterator it = keysClone.iterator(); it.hasNext();) {
                    final Object key = it.next();
                    log(0, "translation.missingKey", key);
                }
            }
            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

     * {@inheritDoc}
     */
    public void process(File[] aFiles)
    {
        final File[] files = filter(aFiles);
        final MessageDispatcher dispatcher = getMessageDispatcher();
        for (int i = 0; i < files.length; i++) {
            final File file = files[i];
            final String path = file.getPath();
            dispatcher.fireFileStarted(path);
            RandomAccessFile randomAccessFile = null;
            try {
                randomAccessFile = new RandomAccessFile(file, "r");
                if (!endsWithNewline(randomAccessFile)) {
                    log(0, "noNewlineAtEOF", path);
                }
            }
            catch (final IOException e) {
                ///CLOVER:OFF
                logIOException(e);
                ///CLOVER:ON
            }
            finally {
                if (randomAccessFile != null) {
                    try {
                        randomAccessFile.close();
                    }
                    catch (final IOException e) {
                        ///CLOVER:OFF
                        logIOException(e);
                        ///CLOVER:ON
                    }
                }
            }
            fireErrors(path);
            dispatcher.fireFileFinished(path);
        }
    }
View Full Code Here

TOP

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

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.