|
1 | 1 | /*
|
2 |
| - * Copyright 2016-2023 DiffPlug |
| 2 | + * Copyright 2016-2024 DiffPlug |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -427,9 +427,22 @@ private String format(ProcessRunner runner, String input, File file) throws IOEx
|
427 | 427 | var stdin = input.getBytes(StandardCharsets.UTF_8);
|
428 | 428 | var args = buildBiomeCommand(file);
|
429 | 429 | if (logger.isDebugEnabled()) {
|
430 |
| - logger.debug("Running Biome comand to format code: '{}'", String.join(", ", args)); |
| 430 | + logger.debug("Running Biome command to format code: '{}'", String.join(", ", args)); |
| 431 | + } |
| 432 | + var runnerResult = runner.exec(stdin, args); |
| 433 | + var stdErr = runnerResult.stdErrUtf8(); |
| 434 | + if (!stdErr.isEmpty()) { |
| 435 | + logger.warn("Biome stderr ouptut for file '{}'\n{}", file, stdErr.trim()); |
| 436 | + } |
| 437 | + var formatted = runnerResult.assertExitZero(StandardCharsets.UTF_8); |
| 438 | + // When biome encounters an ignored file, it does not output any formatted code |
| 439 | + // Ignored files come from (a) the biome.json configuration file and (b) from |
| 440 | + // a list of hard-coded file names, such as package.json or tsconfig.json. |
| 441 | + if (formatted.isEmpty()) { |
| 442 | + return input; |
| 443 | + } else { |
| 444 | + return formatted; |
431 | 445 | }
|
432 |
| - return runner.exec(stdin, args).assertExitZero(StandardCharsets.UTF_8); |
433 | 446 | }
|
434 | 447 |
|
435 | 448 | /**
|
|
0 commit comments