Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.selesse.jxlint.actions;
 
Handler of action-based logic relating to linting. This particular LintHandler's core logic is in lintAndReportAndExit(boolean).
public class LintHandler {
    private static final Logger LOGGER = LoggerFactory.getLogger(LintHandler.class);
    private final List<LintRulelintRules;
    private final boolean warningsAreErrors;
    private final ProgramOptions options;
    private final ProgramSettings settings;
    public LintHandler(List<LintRulelintRulesboolean warningsAreErrorsProgramOptions options,
                       ProgramSettings settings) {
        this. = lintRules;
        this. = warningsAreErrors;
        this. = options;
        this. = settings;
    }

    
Performs the linting via the com.selesse.jxlint.linter.Linter, reports the errors, and exits the program via com.selesse.jxlint.ProgramExitter, if exitAfterReport is true. The com.selesse.jxlint.report.Reporter created is based on the com.selesse.jxlint.model.ProgramOptions passed in the constructor.
    public void lintAndReportAndExit(boolean exitAfterReport) {
        .debug("Performing validations against these lint rules: {}");
        Linter linter = LinterFactory.createNewLinter();
        linter.performLintValidations();
        List<LintErrorlintErrors = linter.getLintErrors();
        reportLintErrors(lintErrors);
        .debug("Exiting? {}"exitAfterReport);
        if (exitAfterReport) {
            exitWithAppropriateStatus(lintErrors);
        }
    }
    private void reportLintErrors(List<LintErrorlintErrorsProgramSettings settingsProgramOptions options) {
        OutputType outputType = options.getOutputType();
        String outputTypePath = options.getOption(.);
        try {
            Reporter reporter = Reporters.createReporter(lintErrorssettingsoutputTypeoutputTypePath);
            reporter.writeReport();
        }
        catch (UnableToCreateReportException e) {
            ProgramExitter.exitProgramWithMessage(e.getMessage(), .);
        }
    }
    private void exitWithAppropriateStatus(List<LintErrorlintErrors) {
        if ( && lintErrors.size() > 0) {
            ProgramExitter.exitProgram(.);
        }
        if (lintErrors.size() > 0) {
            for (LintError error : lintErrors) {
                if (error.getSeverity().ordinal() >= ..ordinal()) {
                    ProgramExitter.exitProgram(.);
                }
            }
        }
        ProgramExitter.exitProgram(.);
    }
New to GrepCode? Check out our FAQ X