How to Customize Packwerk's Public Code Determination with Ruby Code?

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Is it possible to hook into and fully customize how Packwerk determines what is public and not? For now, we decided the default approach of path-based demarcation. Is there a hook in the software where I can write custom Ruby code to mark a class / file as containing public code?

There’s not any way to hook into this to provide arbitrary declarations of public API, but public API comment sigils was just recently added. Does this give you the flexibility you need?

https://github.com/rubyatscale/packwerk-extensions#defining-public-constants-through-sigil

I was thinking of introducing a convention like a Company:: or Public:: namespace (see this thread). But yeah, the sigil-based approach could be used in combination with such a convention. :+1:

Message originally sent by slack user U70TIGAX94P

You may be able to write an extension that uses namespaces to decide whether something is public or not… However, I’m not very familiar with the extension interface

Message originally sent by slack user U70TIGAX94P

The other thing is - if for now you just want to make public vs private visible and don’t want to enforce it (this is what I understood from the other thread), just using the namespace without any tooling support may be good enough.