Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.selesse.jxlint.linter;
 import java.util.List;
Simple implementation of a Linter. Goes through all the com.selesse.jxlint.model.rules.LintRules and calls com.selesse.jxlint.model.rules.LintRule.validate(). If there are any errors, this class accumulates them. Call getLintErrors() to retrieve them.
public class Linter {
    private static final Logger LOGGER = LoggerFactory.getLogger(Linter.class);
    private static final int THREADS = Runtime.getRuntime().availableProcessors();
    private List<LintRulerules;
    private List<LintErrorlintErrors;
    public Linter(List<LintRulerules) {
        this. = rules;
        this. = Lists.newArrayList();

This validates (or invalidates) every lint rule. com.selesse.jxlint.model.rules.LintErrors may arise through failed validations. For every rule that fails a validation, there should be a corresponding com.selesse.jxlint.model.rules.LintError.
    public void performLintValidations() {
        List<ValidationThreadlintRuleThreads = getValidationThreads();
        try {
            .debug("Initializing pool of {} threads");
            final ExecutorService executorService = Executors.newFixedThreadPool();
            List<Future<List<LintError>>> futures = executorService.invokeAll(lintRuleThreads);
            executorService.awaitTermination(24, .);
            for (Future<List<LintError>> ruleLintErrors : futures) {
        catch (InterruptedException e) {
            .error("Thread interrupted while validating"e);
        catch (ExecutionException e) {
            .error("Execution exception thrown while validating"e);
        List<ValidationThreadvalidationThreads = Lists.newArrayList();
        for (LintRule lintRule : rules) {
            validationThreads.add(new ValidationThread(lintRule));
        return validationThreads;

Returns all the com.selesse.jxlint.model.rules.LintErrors that have been found through validations performed in performLintValidations().
    public List<LintErrorgetLintErrors() {
        return ;
New to GrepCode? Check out our FAQ X