Skip to content

Commit a614fd3

Browse files
committed
Warn when editorUrl is not configured
1 parent 36b6f13 commit a614fd3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/TicketSwapErrorFormatter.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public static function getLinkFormatFromEnv() : string
4242
#[Override]
4343
public function formatErrors(AnalysisResult $analysisResult, Output $output) : int
4444
{
45+
if ($this->editorUrl === null) {
46+
$output->writeLineFormatted('<error>Please configure the `editorUrl`.</error>');
47+
$output->writeLineFormatted('');
48+
}
49+
4550
if (! $analysisResult->hasErrors()) {
4651
$output->writeLineFormatted('<fg=green;options=bold>No errors</>');
4752
$output->writeLineFormatted('');
@@ -84,14 +89,14 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output) : i
8489
(int) $error->getLine(),
8590
$error->getFilePath(),
8691
$this->relativePathHelper->getRelativePath($error->getFilePath()),
87-
$this->editorUrl ?? '',
92+
$this->editorUrl ,
8893
),
8994
$error->getTraitFilePath() !== null ? $this::link(
9095
$this->linkFormat,
9196
(int) $error->getLine(),
9297
$error->getTraitFilePath(),
9398
$this->relativePathHelper->getRelativePath($error->getTraitFilePath()),
94-
$this->editorUrl ?? '',
99+
$this->editorUrl ,
95100
) : '',
96101
]),
97102
],
@@ -118,8 +123,12 @@ public static function link(
118123
int $line,
119124
string $absolutePath,
120125
string $relativePath,
121-
string $editorUrl) : string
122-
{
126+
?string $editorUrl
127+
) : string {
128+
if ($editorUrl === null) {
129+
return sprintf('%s:%d', $relativePath, $line);
130+
}
131+
123132
return strtr(
124133
$format,
125134
[

0 commit comments

Comments
 (0)