Skip to content

Commit

Permalink
Merge pull request #905 from plopesc/master
Browse files Browse the repository at this point in the history
Fix suffix property for PhpCpd v6
  • Loading branch information
veewee authored May 12, 2021
2 parents 244c871 + 943e93d commit e934e0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Task/PhpCpd.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public function run(ContextInterface $context): TaskResultInterface

$arguments = $this->processBuilder->createArgumentsForCommand('phpcpd');
$extensions = array_map(function (string $extension) {
return sprintf('*.%s', $extension);
return sprintf('.%s', $extension);
}, $config['triggered_by']);

$arguments->addArgumentArray('--exclude=%s', $config['exclude']);
$arguments->addRequiredArgument('--min-lines=%u', (string) $config['min_lines']);
$arguments->addRequiredArgument('--min-tokens=%u', (string) $config['min_tokens']);
$arguments->addOptionalCommaSeparatedArgument('--suffix=%s', $extensions);
$arguments->addArgumentArray('--suffix=%s', $extensions);
$arguments->addOptionalArgument('--fuzzy', $config['fuzzy']);
$arguments->addArgumentArray('%s', $config['directory']);

Expand Down
15 changes: 8 additions & 7 deletions test/Unit/Task/PhpCpdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function provideExternalTaskRuns(): iterable
'--exclude=vendor',
'--min-lines=5',
'--min-tokens=70',
'--suffix=*.php',
'--suffix=.php',
'.',
],
];
Expand All @@ -44,7 +44,7 @@ public function provideExternalTaskRuns(): iterable
'--exclude=vendor',
'--min-lines=5',
'--min-tokens=70',
'--suffix=*.php',
'--suffix=.php',
'folder-1',
'folder-2',
],
Expand All @@ -61,7 +61,7 @@ public function provideExternalTaskRuns(): iterable
'--exclude=folder-2',
'--min-lines=5',
'--min-tokens=70',
'--suffix=*.php',
'--suffix=.php',
'.',
],
];
Expand All @@ -76,7 +76,7 @@ public function provideExternalTaskRuns(): iterable
'--exclude=vendor',
'--min-lines=5',
'--min-tokens=70',
'--suffix=*.php',
'--suffix=.php',
'--fuzzy',
'.',
],
Expand All @@ -92,7 +92,7 @@ public function provideExternalTaskRuns(): iterable
'--exclude=vendor',
'--min-lines=10',
'--min-tokens=70',
'--suffix=*.php',
'--suffix=.php',
'.',
],
];
Expand All @@ -107,7 +107,7 @@ public function provideExternalTaskRuns(): iterable
'--exclude=vendor',
'--min-lines=5',
'--min-tokens=10',
'--suffix=*.php',
'--suffix=.php',
'.',
],
];
Expand All @@ -122,7 +122,8 @@ public function provideExternalTaskRuns(): iterable
'--exclude=vendor',
'--min-lines=5',
'--min-tokens=70',
'--suffix=*.php,*.html',
'--suffix=.php',
'--suffix=.html',
'.',
],
];
Expand Down

0 comments on commit e934e0d

Please sign in to comment.