sebastianbergmann/phpcpd

The "regexps-exclude" option actually takes non-regex values

vyshkant opened this issue · 2 comments

The value of the regexps-exclude option of theSebastianBergmann\PHPCPD\CLI\Command is used as the argument $regularExpressionsExcludes of SebastianBergmann\FinderFacade\FinderFacade class.

The values of the $regularExpressionsExcludes property are passed to the Symfony\Component\Finder\Finder with notPath method:

foreach ($this->regularExpressionsExcludes as $regularExpressionExclude) {
    $finder->notPath($regularExpressionExclude);
}

(https://github.com/sebastianbergmann/finder-facade/blob/b73fcdcf349c6245c59a8165704c71ed1794dc96/src/FinderFacade.php#L95-L97)

But the path and notPath methods of Symfony\Component\Finder\Finder don't only accept the regex values:

You can use patterns (delimited with / sign) or simple strings.

(http://api.symfony.com/4.0/Symfony/Component/Finder/Finder.html#method_notPath)

This means that the name "regexps-exclude" poorly describes the accepted option values.

My suggestion is to rename this option to "paths-exclude" (maybe to add a duplicate-behavior option with new name and to mark "regexps-exclude" as deprecated to avoid violation of backward compatibility).

This also applies to SebastianBergmann\FinderFacade\FinderFacade package.

If you don't mind, I'll gladly write the PRs to both repositories.

stale commented

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.

stale commented

This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.