Enforce bounded contexts with Rubocop Cop
## Problem As a result of https://gitlab.com/gitlab-org/gitlab/-/issues/438294+ we [added a configuration file in GitLab rails](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/149543) that describes the bounded contexts at play in the monolith's domain layer. We need a way to enforce these namespaces and ensure that no other namespaces are used for domain code aside from the defined bounded contexts. ## Proposal We have a basic Rubocop Cop called [Gitlab/NamespacedClass](https://gitlab.com/gitlab-org/gitlab/-/blob/d97953c2e61a6539097450f9d9cc75b5dbdc94e8/rubocop/cop/gitlab/namespaced_class.rb#L0-1) that ensures any Ruby constant is namespaced. We can improve this Cop by ensuring that for domain code we must use Ruby namespaces defined in the bounded context YAML file. Note that bounded contexts are enforced for the "domain layer" only, in `app` and `lib` directories, but some sub-directories are excluded: https://gitlab.com/gitlab-org/gitlab/-/issues/438294#how-is-the-list-generated. For example, we should not enforce the bounded contexts namespace for controllers or view components (yet).
issue