Remove spaces between arguments

Blank spaces between the arguments of the GithubActionReporter
messages make them appear always on line 1.
This commit is contained in:
Fran Moreno 2021-05-01 01:51:39 +02:00
parent 8ff0a3e6f2
commit bd638a0fd8
3 changed files with 5 additions and 5 deletions

View File

@ -94,6 +94,6 @@ class GithubActionReporter
return; 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));
} }
} }

View File

@ -64,7 +64,7 @@ class GithubActionReporterTest extends TestCase
'foo/bar.php', 'foo/bar.php',
2, 2,
4, 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' => [ yield 'with file property to escape' => [
@ -73,7 +73,7 @@ class GithubActionReporterTest extends TestCase
'foo,bar:baz%quz.php', 'foo,bar:baz%quz.php',
2, 2,
4, 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']; yield 'without file ignores col & line' => ['warning', 'A warning', null, 2, 4, '::warning::A warning'];

View File

@ -85,7 +85,7 @@ YAML;
} }
self::assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error'); 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() public function testLintAutodetectsGithubActionEnvironment()
@ -109,7 +109,7 @@ YAML;
$tester->execute(['filename' => $filename], ['decorated' => false]); $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 { } finally {
putenv('GITHUB_ACTIONS'.($prev ? "=$prev" : '')); putenv('GITHUB_ACTIONS'.($prev ? "=$prev" : ''));
} }