Skip to content

Ban use of License in ApplicationSetting model

Taras Tadai requested to merge 424200-ban-use-license-in-app-setting into master

What does this MR do and why?

The model ApplicationSetting has validations that in turn run License.feature_available? check. This creates a cyclical dependency between the ApplicationSetting record being created and the License class that in turn depends on the presence of ApplicationSetting record.

We have an existing spec that verifies that:

https://gitlab.com/gitlab-org/gitlab/-/blob/0abbd0bfc6ae42c631920ce42b1e0d42554caded/ee/spec/models/application_setting_spec.rb#L10-19

As an additional validation we want to create a Rubocop rule to ban the use of License.feature_available? in ApplicationSetting and Gitlab::CurrentSettings, since their presence can cause cyclical dependencies.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #424200

Merge request reports