-
Notifications
You must be signed in to change notification settings - Fork 61
Support only checking the files you changed with the -h option #76
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,12 @@ class Settings | |
*/ | ||
public $phpExecutable = 'php'; | ||
|
||
/** | ||
* Git executable | ||
* @var string | ||
*/ | ||
public $changedFiles = 'git'; | ||
|
||
/** | ||
* Check code inside PHP opening short tag <? or <?= in PHP 5.3 | ||
* @var bool | ||
|
@@ -126,6 +132,14 @@ public static function parseArguments(array $arguments) | |
{ | ||
$arguments = new ArrayIterator(array_slice($arguments, 1)); | ||
$settings = new self; | ||
|
||
$git = "git show HEAD \ | ||
--name-only \ | ||
--diff-filter=ACM \ | ||
-m \ | ||
--first-parent \ | ||
--format=format: \ | ||
-- "'*' . array('.php', '.phtml', '.php3', '.php4', '.php5')" | egrep -v '^$' || :"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. on second thought, you should probably refactor this to avoid use shell pipe formatting. what is you trying to filter out? can you give example? perhaps fixing --format or other arguments helps otherwise filter it in php side. more readable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PHP Parallel Lint is supported on Windows too and this does not work on this OS. So I think, this must be reimplemented in PHP. |
||
|
||
foreach ($arguments as $argument) { | ||
if ($argument{0} !== '-') { | ||
|
@@ -150,6 +164,10 @@ public static function parseArguments(array $arguments) | |
$settings->excluded[] = $arguments->getNext(); | ||
break; | ||
|
||
case '--head': | ||
$settings->changedFiles = exec($git); | ||
break; | ||
|
||
case '-e': | ||
$settings->extensions = array_map('trim', explode(',', $arguments->getNext())); | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do this line? It do concat string with array. I mean that a result of this expression have non-sence.