Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.selesse.jxlint.report;
 
 
 import java.io.File;
The DefaultReporter is the default CLI Reporter.
public class DefaultReporter extends Reporter {
    public DefaultReporter(PrintStream outProgramSettings programSettingsList<LintErrorlintErrorList) {
        super(outprogramSettingslintErrorList);
    }
    @Override
    public void printHeader() {
    }
    @Override
    protected void printCategoryHeader(Enum<?> category) {
        .println();
        .println("    " + ..wrapAround("-- " + category + " --"));
        .println();
    }
    @Override
    public void printError(LintError error) {
        File sourceDirectory = LintRulesImpl.getInstance().getSourceDirectory();
        String relativePath = sourceDirectory.toURI().relativize(error.getFile().toURI()).getPath();
        int errorLineNumber = error.getLineNumber();
        String lineNumberString = "";
        if (errorLineNumber > 0) {
            lineNumberString = " on line " + errorLineNumber;
        }
        LintRule violatedRule = error.getViolatedRule();
        .println(String.format("[%s] \"%s\" in %s%s",  colorSeverity(error.getSeverity()),
                ..wrapAround(violatedRule.getName()), relativePathlineNumberString));
        if (!Strings.isNullOrEmpty(error.getMessage())) {
            .println("    " + error.getMessage());
        }
        .println();
    }
    private String colorSeverity(Severity severity) {
        return severity.getColor().wrapAround(EnumUtils.toHappyString(severity));
    }
    @Override
    public void printFooter() {
        if (.size() > 0) {
            .println(getErrorReportString());
        }
    }
New to GrepCode? Check out our FAQ X