tomzx / php-semver-checker

Compares two source sets and determines the appropriate semantic versioning to apply.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File matching regexes with different level mappings

tomzx opened this issue · comments

It might be interesting to allow users to define level mapping based on some form of regex matching.

For example, given a regex that matches a Console/Commands directory, we want to apply at most MINOR levels as we are not expecting users to be inheriting from these commands.

Issue:

  • Multiple regexes may match a file, in which case, which regex/set of mappings should be used?

Just make your command as final to be sure that it's not extendable

@spolischook Agreed.

However, it is not all code that is written that way and some people may want to use php-semver-checker to check their code dependencies. Thus, the purpose of this idea is to make it easier for them to specify rules that will be more aligned with their use case.

Is it possible to remove files from compare by regexp path?

@spolischook At the moment, regexes are not supposed by the file finder, so it is not possible to include/exclude files by regex.

I'm using

php-semver-checker compare ./$BASE_VERSION_DIR ./$PR_VERSION_DIR --exclude-after=*/Tests/,*/TestFrameworkBundle/ --exclude-before=*/Tests/,*/TestFrameworkBundle/

and it's works for me!

@spolischook It does support some form of glob file path matching (supports *, ? and [...]), but I assumed you were talking about regex patterns.