From 96de905b284b0f41440c047249de5e292350ae0d Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Fri, 18 Sep 2020 00:09:21 -0700 Subject: [PATCH 1/5] Don't assume file is 50 characters long --- .../java/com/diffplug/spotless/npm/PrettierFormatterStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java index fb7c3ef1f9..19386950d8 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java @@ -113,7 +113,7 @@ public PrettierFilePathPassingFormatterFunc(String prettierConfigOptions, Pretti @Override public String applyWithFile(String unix, File file) throws Exception { - FormattedPrinter.SYSOUT.print("formatting String '" + unix.substring(0, 50) + "[...]' in file '" + file + "'"); + FormattedPrinter.SYSOUT.print("formatting String '" + unix.substring(0, Math.min(50, unix.length())) + "[...]' in file '" + file + "'"); final String prettierConfigOptionsWithFilepath = assertFilepathInConfigOptions(file); return restService.format(unix, prettierConfigOptionsWithFilepath); From 37b919484c18c09e699e178e06762038f496cc47 Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Fri, 18 Sep 2020 00:12:40 -0700 Subject: [PATCH 2/5] Update PrettierFormatterStep.java --- .../java/com/diffplug/spotless/npm/PrettierFormatterStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java index 19386950d8..5613f2e2d9 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java @@ -113,7 +113,7 @@ public PrettierFilePathPassingFormatterFunc(String prettierConfigOptions, Pretti @Override public String applyWithFile(String unix, File file) throws Exception { - FormattedPrinter.SYSOUT.print("formatting String '" + unix.substring(0, Math.min(50, unix.length())) + "[...]' in file '" + file + "'"); + FormattedPrinter.SYSOUT.print("formatting String '" + unix.substring(0, Math.min(50, unix.length() - 1)) + "[...]' in file '" + file + "'"); final String prettierConfigOptionsWithFilepath = assertFilepathInConfigOptions(file); return restService.format(unix, prettierConfigOptionsWithFilepath); From 0b6750c41082468d42ee349369c6ffdcda5f3814 Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Fri, 18 Sep 2020 00:15:01 -0700 Subject: [PATCH 3/5] Update CHANGES.md --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 9eb6eccee1..ac90acb298 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ This document is intended for Spotless developers. We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* Don't assume that file content passed into Prettier is at least 50 characters (https://github.com/diffplug/spotless/pull/699). ## [2.6.1] - 2020-09-12 ### Fixed From 81e57c8fb3f449d824532d1d3d4ac91d4b228a66 Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Fri, 18 Sep 2020 00:15:12 -0700 Subject: [PATCH 4/5] Update CHANGES.md --- plugin-gradle/CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 03332cd724..cda854a818 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`). ## [Unreleased] +### Fixed +* Don't assume that file content passed into Prettier is at least 50 characters (https://github.com/diffplug/spotless/pull/699). ## [5.5.1] - 2020-09-12 ### Fixed From aa8a17f2fb12d8cd882d16c5d3f07d8b46f3e32b Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Fri, 18 Sep 2020 00:15:31 -0700 Subject: [PATCH 5/5] Update CHANGES.md --- plugin-maven/CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index bb122af430..20b9d6f12e 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* Don't assume that file content passed into Prettier is at least 50 characters (https://github.com/diffplug/spotless/pull/699). ## [2.4.0] - 2020-09-17 ### Added