Right now, namespaces are a free-for-all and Microsoft will - rightly so - not register or enforce specific namespaces.
However, as a company you will (likely) enforce a namespace structure for your apps and would expect everyone to adhere to it. There is, however, not a way to enforce that at the moment. This means that if a developer forgets a namespace or makes a typo in the namespace and it is not caught at code review, it's in there to stay (at least for AppSource apps) until you can obsolete and fix it.
I would like to therefore suggest a sort of "NamespaceCop" either as a separate code cop or as part of AppSourceCop that allows you to declare allowed namespaces for your apps in a json file (AppSourceCop.json, for example) and will tag unrecognized namespaces with an error.
This should help a great deal in streamlining your internal namespace implementation.
Comments
Something in addition to AppSourceCop.json would be nice, to predefine the base level for namespaces. Additionally, like in Visual Studio, it would be great to have the option to rename namespaces when moving objects from one directory to another.Anyway, to enforce usage of namespaces there is CodeCop AA0247, which we switched to „error“ in our project rulesets. This helps us to enforce usage of namespaces.
Category: Development
Business Central Team (administrator)
Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team