DFE-Digital / DFE-Digital/dfe-analytics
`ServicePattern` pollutes the top-level namespace
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 12
- Forks
- 9
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
The ServicePattern module is defined as a top-level module, rather than being namespaced within the DfE::Analytics module. It therefore pollutes the top-level namespace of any Ruby app which uses the dfe-analytics gem.
For example, this caused some strange behaviour over in https://github.com/DFE-Digital/itt-mentor-services/pull/521#discussion_r1578212067 where we had to manually require our own ServicePattern module directly in a spec file to override the one provided by dfe-analytics.
I think ideally this module should be namespaced inside DfE::Analytics to avoid this from happening – plus to be consistent with the other classes in this gem, which all seem to be namespaced according to their file path.
In other words, I think lib/dfe/analytics/shared/service_pattern.rb should be changed to:
# a template for creating service objects
module DfE
module Analytics
module Shared
module ServicePattern
# ...
end
end
end
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/dfe/analytics/shared/service_pattern.rb and inspect references to ServicePattern across the gem. Confirm how callers load the module, then verify that it is available under the intended DfE::Analytics namespace without polluting the top-level namespace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100