Skip to content

Commit

Permalink
Fix spotbugs warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Dec 3, 2021
1 parent 3a6ba9c commit c5600b5
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ public class KtlintFormatterFunc implements FormatterFunc.NeedsFile {
public KtlintFormatterFunc(boolean isScript, Map<String, String> userData) {
rulesets = Collections.singletonList(new StandardRuleSetProvider().get());
this.userData = userData;
formatterCallback = new Function2<LintError, Boolean, Unit>() {
@Override
public Unit invoke(LintError lint, Boolean corrected) {
if (!corrected) {
throw new AssertionError("Error on line: " + lint.getLine() + ", column: " + lint.getCol() + "\n" + lint.getDetail());
}
return null;
}
};
formatterCallback = new FormatterCallback();
this.isScript = isScript;
}

static class FormatterCallback implements Function2<LintError, Boolean, Unit> {
@Override
public Unit invoke(LintError lint, Boolean corrected) {
if (!corrected) {
throw new AssertionError("Error on line: " + lint.getLine() + ", column: " + lint.getCol() + "\n" + lint.getDetail());
}
return null;
}
}

@Override
public String applyWithFile(String unix, File file) throws Exception {
return KtLint.INSTANCE.format(new Params(
Expand Down

0 comments on commit c5600b5

Please sign in to comment.