Skip to content

Introduce a new Gitlab/MarkUsedFeatureFlags cop

What does this MR do?

This new cop detects feature flags that are actually in use in the codebase (excluding specs).

This successfully detects feature flags that are in use: https://gitlab.com/gitlab-org/gitlab/-/jobs/1299445157

Feature Flags usage summary:
- 462 was found
- 0 appear(s) to be UNUSED
- 11 appear(s) to be unknown
- 451 appear(s) to be used
==================================================
There are feature flags that appears to be unknown
They appear to be used by CI, but we do lack their YAML definition
This is likely expected, so feel free to ignore that list:
- contact_sales_btn_in_app
- gitaly_enforce_requests_limits
- gldropdown_tags
- in_product_marketing_emails
- invite_members_empty_group_version_a
- invite_members_new_dropdown
- learn_gitlab_a
- learn_gitlab_b
- remove_known_trial_form_fields
- show_trial_status_in_sidebar
- trial_onboarding_issues
Everything is fine here!

Comparing with the current results: https://gitlab.com/gitlab-org/gitlab/-/jobs/1280168281

Feature Flags usage summary:
- 480 was found
- 0 appear(s) to be UNUSED
- 21 appear(s) to be unknown
- 459 appear(s) to be used
==================================================
There are feature flags that appears to be unknown
They appear to be used by CI, but we do lack their YAML definition
This is likely expected, so feel free to ignore that list:
- dummy_feature_flag
- experiment_key_experiment_percentage
- gitaly_enforce_requests_limits
- gitaly_global_flag
- gitaly_mep_mep
- gitaly_project_flag
- load_balancing_for_test_data_consistency_worker
- my_experiment_experiment_percentage
- my_feature_flag
- namespaced_stub
- prometheus_metrics_measure_foo_cpu_duration
- prometheus_metrics_method_instrumentation
- prometheus_metrics_view_instrumentation
- some_metric_feature
- test_experiment_experiment_percentage
- test_feature
- test_feature_flag
- test_ff_disabled
- test_ff_enabled
- test_hll_redis_counter_ff_check
- usage_data_unknown
Everything is fine here!

The following 19 flags are only referenced in tests:

- dummy_feature_flag
- experiment_key_experiment_percentage
- gitaly_global_flag
- gitaly_mep_mep
- gitaly_project_flag
- load_balancing_for_test_data_consistency_worker
- my_experiment_experiment_percentage
- my_feature_flag
- namespaced_stub
- prometheus_metrics_measure_foo_cpu_duration
- prometheus_metrics_method_instrumentation
- prometheus_metrics_view_instrumentation
- some_metric_feature
- test_experiment_experiment_percentage
- test_feature
- test_feature_flag
- test_ff_disabled
- test_ff_enabled
- test_hll_redis_counter_ff_check
  • gitaly_enforce_requests_limits is properly detected as in use with the new cop.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #284596 (closed)

Edited by Rémy Coutable

Merge request reports

Loading