Refactor Normalizer to improve readability

What does this MR do and why?

This refactor addresses the technical debt in the Normalizer class that makes the class hard to understand. It achieves three major goals:

  1. Removing the unnecessary block-based approach. Previously, Normalizer used a block to direct logic as it mutated the jobs config. This was challenging to follow and made changes to the class more difficult
  2. Encapsulating mutation in normalize_job. Other private methods are purely functional - this makes it easier to understand where values in the jobs config are modified
  3. Preserving a single iteration through the list of job configs - this ensures that the refactor doesn't degrade performance

The refactor deployment will be derisked by the ci_refactor_normalizer feature flag.

Note: There are a few small code changes that can't be made until we're removing the feature flag. I've left comments above each of those lines

Issue: Refactor Normalizer to improve readability (#571476)

Rollout issue: [FF] `ci_refactor_normalizer` -- gitlab_com_derisk (#577511)

Edited by Avielle Wolfe

Merge request reports

Loading