Use strong_memoize_attr in SCA::LicenseCompliance

What does this MR do and why?

Every memoized method in SCA::LicenseCompliance used the older strong_memoize(:key) { ... } block form. All of them take no arguments and are not combined with override, so each is eligible for strong_memoize_attr, the idiom doc/development/utilities.md documents as the current recommendation for exactly that case:

def result
  search
end
strong_memoize_attr :result

exclusion_allowed_policy_exists? already used this idiom from a previous fix in !257138 (merged); every other memoized method in the class now matches it.

known_policies and license_policies each had an early return guard before the memoized computation. strong_memoize_attr wraps the whole method body, so the guard now gets cached too. Neither guard's return value depends on anything mutable between calls, so this changes nothing observable, it just makes the memoization consistent with the rest of the method instead of only covering the non-guarded path.

No behavior change.

How to set up and validate locally

This is a pure refactor with no user-visible behavior change; it's covered by the existing spec suite for this class (ee/spec/models/sca/license_compliance_spec.rb).

References

Edited by Marcos Rocha

Merge request reports

Loading
Loading