Refactor ExtractsRef into class
Background
ExtractsRef (lib/extracts_path.rb) and ExtractsPath (lib/extracts_ref.rb) are modules used to extract various git related strings from request parameters.
There are two problems with the modules.
-
Contrary to what their location indicates (
lib), they have been written to be used as controller concerns and the vast majority of their consumers are Rails controllers. -
They extensively use instance variables to achieve their goals and it's hard to reason about the code !131125 (comment 1546934017).
What does this MR do and why?
-
This MR creates
ExtractsRef::RefExtractor, a refactored class version ofExtractsRef. -
Swap out
ExtractsRefwithExtractsRef::RefExtractorthroughout the codebase. -
ExtractsRefis refactored to useExtractsRef::RefExtractorwhenever possible.ExtractsRefis not removed and is left in place becauseExtractsPathdepends onExtractsRefin a convoluted manner. I created a dedicated issue to refactorExtractsPath#425379.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #422133 (closed)