<commit_before>package hudson.plugins.warnings.parser;

import hudson.plugins.warnings.util.model.FileAnnotation;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Registry for the active parsers in this plug-in.
 *
 * @author <NAME>
 */
public class ParserRegistry {
    /** The available parsers of this plug-in. */
    private final List<AnnotationParser> parsers = new ArrayList<AnnotationParser>();

    /**
     * Creates a new instance of <code>ParserRegistry</code>.
     */
    public ParserRegistry() {
        parsers.add(new HpiCompileParser());
        parsers.add(new JavacParser());
    }

    /**
     * Iterates over the available parsers and parses the specified file with each parser.
     * Returns all found warnings.
     *
     * @param file the input stream
     * @return all found warnings
     *
     * @throws IOException Signals that an I/O exception has occurred.
     */
    public Collection<FileAnnotation> parse(final File file) throws IOException {
        List<FileAnnotation> annotations = new ArrayList<FileAnnotation>();
        for (AnnotationParser parser : parsers) {
            annotations.addAll(parser.parse(createInputStream(file)));
        }
        return annotations;
    }

    /**
     * Creates the input stream to parse from the specified file.
     *
     * @param file the file to parse
     * @return the input stream
     * @throws FileNotFoundException
     */
    protected InputStream createInputStream(final File file) throws FileNotFoundException {
        return new FileInputStream(file);
    }
}

<commit_msg>Issue 1688: Added compiler warnings support for MSBuild.<commit_after>package hudson.plugins.warnings.parser;

import hudson.plugins.warnings.util.model.FileAnnotation;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Registry for the active parsers in this plug-in.
 *
 * @author <NAME>
 */
public class ParserRegistry {
    /** The available parsers of this plug-in. */
    private final List<AnnotationParser> parsers = new ArrayList<AnnotationParser>();

    /**
     * Creates a new instance of <code>ParserRegistry</code>.
     */
    public ParserRegistry() {
        parsers.add(new HpiCompileParser());
        parsers.add(new JavacParser());
        parsers.add(new MsBuildParser());
    }

    /**
     * Iterates over the available parsers and parses the specified file with each parser.
     * Returns all found warnings.
     *
     * @param file the input stream
     * @return all found warnings
     *
     * @throws IOException Signals that an I/O exception has occurred.
     */
    public Collection<FileAnnotation> parse(final File file) throws IOException {
        List<FileAnnotation> annotations = new ArrayList<FileAnnotation>();
        for (AnnotationParser parser : parsers) {
            annotations.addAll(parser.parse(createInputStream(file)));
        }
        return annotations;
    }

    /**
     * Creates the input stream to parse from the specified file.
     *
     * @param file the file to parse
     * @return the input stream
     * @throws FileNotFoundException
     */
    protected InputStream createInputStream(final File file) throws FileNotFoundException {
        return new FileInputStream(file);
    }
}


{'fraction_non_alphanumeric': 0.09012875536480687, 'fraction_numerical': 0.001072961373390558, 'mean_word_length': 2.71044776119403, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5830969', 'n_tokens_mistral': 1019, 'n_tokens_neox': 955, 'n_words': 293}