From bd638a0fd81b3e2a652cf221d427015e7a0c4ff7 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sat, 1 May 2021 01:51:39 +0200 Subject: [PATCH] Remove spaces between arguments Blank spaces between the arguments of the GithubActionReporter messages make them appear always on line 1. --- src/Symfony/Component/Console/CI/GithubActionReporter.php | 2 +- .../Component/Console/Tests/CI/GithubActionReporterTest.php | 4 ++-- src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Console/CI/GithubActionReporter.php b/src/Symfony/Component/Console/CI/GithubActionReporter.php index 0ae18ca15e8a0..a15c1ff18b864 100644 --- a/src/Symfony/Component/Console/CI/GithubActionReporter.php +++ b/src/Symfony/Component/Console/CI/GithubActionReporter.php @@ -94,6 +94,6 @@ private function log(string $type, string $message, string $file = null, int $li return; } - $this->output->writeln(sprintf('::%s file=%s, line=%s, col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message)); + $this->output->writeln(sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message)); } } diff --git a/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php b/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php index 4325508399113..6ef190f162f09 100644 --- a/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php +++ b/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php @@ -64,7 +64,7 @@ public function annotationsFormatProvider(): iterable 'foo/bar.php', 2, 4, - '::warning file=foo/bar.php, line=2, col=4::A warning', + '::warning file=foo/bar.php,line=2,col=4::A warning', ]; yield 'with file property to escape' => [ @@ -73,7 +73,7 @@ public function annotationsFormatProvider(): iterable 'foo,bar:baz%quz.php', 2, 4, - '::warning file=foo%2Cbar%3Abaz%25quz.php, line=2, col=4::A warning', + '::warning file=foo%2Cbar%3Abaz%25quz.php,line=2,col=4::A warning', ]; yield 'without file ignores col & line' => ['warning', 'A warning', null, 2, 4, '::warning::A warning']; diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php index 3eabbdc41e051..6c394f95fd3dc 100644 --- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php @@ -85,7 +85,7 @@ public function testLintIncorrectFileWithGithubFormat() } self::assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error'); - self::assertStringMatchesFormat('%A::error file=%s, line=2, col=0::Unable to parse at line 2 (near "bar")%A', trim($tester->getDisplay())); + self::assertStringMatchesFormat('%A::error file=%s,line=2,col=0::Unable to parse at line 2 (near "bar")%A', trim($tester->getDisplay())); } public function testLintAutodetectsGithubActionEnvironment() @@ -109,7 +109,7 @@ public function testLintAutodetectsGithubActionEnvironment() $tester->execute(['filename' => $filename], ['decorated' => false]); - self::assertStringMatchesFormat('%A::error file=%s, line=2, col=0::Unable to parse at line 2 (near "bar")%A', trim($tester->getDisplay())); + self::assertStringMatchesFormat('%A::error file=%s,line=2,col=0::Unable to parse at line 2 (near "bar")%A', trim($tester->getDisplay())); } finally { putenv('GITHUB_ACTIONS'.($prev ? "=$prev" : '')); }