This bugfix release includes a better detection of disallowed attributes reallowed in a method with attributes (#304)
The original 4.3.0 release notes:
This release has been sponsored by @TicketSwap & @ruudk, thank you 🍰
Re-allow in class with/by attributes (#296, #298)
So far, when you wanted to re-allow a disallowed function or a method, or specifically disallow them, you could use:
- an
allowIn
path to specify a path or a filename where the function or method could be called without generating an error - or
allowInMethods
(or theallowInFunctions
alias) to specify functions and methods in which the disallowed function would be allowed - you could also use the companion directives
disallowIn
ordisallowInMethods
(or theallowExceptIn[...]
aliases) if you wanted to list paths or methods in which the call is explicitly disallowed
Starting with this release, you can use attributes to sort of mark functions and methods in which the disallowed call would be allowed (or explicitly disallowed):
- use
allowInClassWithAttributes
to allow for example a method in a class that has a specified class attribute - use
allowInMethodsWithAttributes
(or thedisallowInFunctionsWithAttributes
alias) to allow the call in methods (or function) with the given method attribute (or a function attribute) - use
allowInClassWithMethodAttributes
to allow a call in a class where any method has the attribute, where "any method" includes any other method as well, static or not, public, private, or protected - you can also use the
disallowIn[...]
counterparts (withallowExceptIn[...]
aliases) to specify only classes and methods in which the call should be disallowed
This allows you to create rules that do not depend on paths or method names, and can be useful if you're working with frameworks or libs that already use attributes. You can specify multiple items in the directives above and only one of them needs to match (it's not an AND list, more like OR list) and they all support fnmatch
patterns.
Other minor changes
- More callable param tests for a bugfix in the previous release (#295)
- Call
fnmatch
less often only when needed (#297) - Tweak attribute example in the
disallowedAttributes
docs (#299, thanks @ruudk)
You too can sponsor a release or buy me a 🍻 or a 🍰, thanks!