Skip to content

Commit c8c773e

Browse files
authored
Merge pull request #1174 from PHPCSStandards/phpcs-4.0/feature/fix-progressbar-parallel
Runner: fix progress bar when running in parallel
2 parents bd2d185 + 4cb0190 commit c8c773e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Runner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ public function printProgress(File $file, $numFiles, $numProcessed)
791791
$errors = $file->getErrorCount();
792792
$warnings = $file->getWarningCount();
793793
$fixable = $file->getFixableCount();
794-
$fixed = $file->getFixedCount();
794+
$fixed = ($file->getFixedErrorCount() + $file->getFixedWarningCount());
795795

796796
if (PHP_CODESNIFFER_CBF === true) {
797797
// Files with fixed errors or warnings are F (green).

tests/EndToEnd/phpcbf_test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ function test_phpcbf_returns_error_on_issues() {
2626
assert_contains "A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE" "$OUTPUT"
2727
}
2828

29+
function test_phpcbf_progressbar_shows_fixes_with_parallel_on() {
30+
OUTPUT="$( { bin/phpcbf --no-colors --parallel=10 --no-cache --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc; } 2>&1 )"
31+
assert_successful_code
32+
33+
assert_contains "F 1 / 1 (100%)" "$OUTPUT"
34+
}
35+
2936
function test_phpcbf_bug_1112() {
3037
# See https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1112
3138
if [[ "$(uname)" == "Darwin" ]]; then

0 commit comments

Comments
 (0)