Skip to content

Commit

Permalink
Add support for ktlint FilenameRule
Browse files Browse the repository at this point in the history
  • Loading branch information
smpanaro committed Oct 26, 2021
1 parent 2e61129 commit 504a4d2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ FormatterFunc createFormat() throws Exception {
/* editorConfigPath, nullable */ String.class,
/* debug */ boolean.class);
Method formatterMethod = ktlintClass.getMethod("format", paramsClass);
formatterFunc = input -> {
FormatterFunc.NeedsFile needsFile = (input, file) -> {
try {
Object params = constructor.newInstance(
/* fileName, nullable */ null,
/* fileName, nullable */ file.getName(),
/* text */ input,
/* ruleSets */ ruleSets,
/* userData */ userData,
Expand All @@ -170,6 +170,7 @@ FormatterFunc createFormat() throws Exception {
throw ThrowingEx.unwrapCause(e);
}
};
formatterFunc = FormatterFunc.needsFile(needsFile);
} else {
// and its format method
String formatterMethodName = isScript ? "formatScript" : "format";
Expand Down

0 comments on commit 504a4d2

Please sign in to comment.