Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit f53f83f

Browse files
committed
Git blame is optional with CLI parameter --blame
Closes #43
1 parent 41365ce commit f53f83f

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

parallel-lint.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function showOptions()
2525
--json Output results as JSON string (require PHP 5.4).
2626
--git <git> Path to Git executable to show blame message (default: 'git').
2727
--stdin Load files and folder to test from standard input.
28+
--blame Try to show git blame for row with error.
2829
-h, --help Print this help.
2930
<?php
3031
}

src/Manager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public function run(Settings $settings = null)
7979

8080
$result = $parallelLint->lint($files);
8181

82-
$this->gitBlame($result, $settings);
82+
if ($settings->blame) {
83+
$this->gitBlame($result, $settings);
84+
}
8385

8486
$output->writeResult($result, new ErrorFormatter($settings->colors, $translateTokens));
8587

src/Settings.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ class Settings
9292
*/
9393
public $stdin = false;
9494

95+
/**
96+
* Try to show git blame for row with error
97+
* @var bool
98+
*/
99+
public $blame = false;
100+
95101
/**
96102
* Path to git executable
97103
* @var string
@@ -163,6 +169,10 @@ public static function parseArguments(array $arguments)
163169
$settings->stdin = true;
164170
break;
165171

172+
case '--blame':
173+
$settings->blame = true;
174+
break;
175+
166176
default:
167177
throw new InvalidArgumentException($argument);
168178
}

0 commit comments

Comments
 (0)