Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review specifictiy calculation for package patterns #49

Closed
skuzzle opened this issue Oct 22, 2021 · 1 comment
Closed

Review specifictiy calculation for package patterns #49

skuzzle opened this issue Oct 22, 2021 · 1 comment

Comments

@skuzzle
Copy link
Owner

skuzzle commented Oct 22, 2021

Calculation quite arbitrarily counts numbers of wildcards. I feel that also the wildcard's position should be taken into account as well. For example com.foo.bar.**.abc.de feels more specific than com.foo.**.bar.abc.de.
In general, if a pattern is a prefix of another, the pattern where the first wildcard occurs later (farther right) is more specific than the other

@skuzzle
Copy link
Owner Author

skuzzle commented Nov 1, 2021

From version 2.x.x on, specificy will be defined as follows:
A single part of a pattern can be assigned a specificy like this:

Part Specificy
** 0
* 1
else 2

When comparing 2 patterns for specificy, we simply calculate the specificy of the first part, in which both patterns differ. If no such part exists (= one pattern is an exact prefix of the other), the specifixy is calculated by comparing both pattern's part count. So naturally the longer pattern becomes the more specific one.

@skuzzle skuzzle closed this as completed Nov 1, 2021
@skuzzle skuzzle changed the title Review specificy calculation for package patterns Review specifictiy calculation for package patterns Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant