Skip to content

Re-allow in class with/by attributes

Latest
Compare
Choose a tag to compare
@spaze spaze released this 12 Feb 02:36
· 4 commits to main since this release
50cedf9

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 the allowInFunctions alias) to specify functions and methods in which the disallowed function would be allowed
  • you could also use the companion directives disallowIn or disallowInMethods (or the allowExceptIn[...] 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 the disallowInFunctionsWithAttributes 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 (with allowExceptIn[...] 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


You too can sponsor a release or buy me a 🍻 or a 🍰, thanks!