Add cop to catch when using stub_feature_flags in before_all
Description of the proposal
Add a new cop to catch the usage of stub_feature_flags
in before_all
.
Using stub_feature_flags
in before_all
leads to incorrect behaviour when there're more than one linked examples, since stub_feature_flags
is called once before the first example, but the feature flag state will be reset after every example https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/spec_helper.rb#L470.
The new cop discourages using stub_feature_flags
in before_all
hook and instead recommends using it in before
hook.
Check-list
-
Make sure this MR enables a static analysis check rule for new usage but ignores current offenses. -
Mention this proposal in the relevant Slack channels (e.g. #development
,#backend
,#frontend
). - [-] If there is a choice to make between two potential styles, set up an emoji vote in the MR:
- CHOICE_A:
🅰️ - CHOICE_B:
🅱️ - Vote for both choices, so they are visible to others.
- CHOICE_A:
-
The MR doesn't have significant objections, and is getting a majority of 👍 vs👎 (remember that we don't need to reach a consensus). - [-] (If applicable) One style is getting a majority of vote (compared to the other choice).
- [-] (If applicable) Update the MR with the chosen style.
-
Create a follow-up issue to fix the current offenses as a separate iteration: ISSUE_LINK -
Follow the review process as usual. -
Once approved and merged by a maintainer, mention it again: -
In the relevant Slack channels (e.g. #development
,#backend
,#frontend
). -
(Optional depending on the impact of the change) In the Engineering Week in Review.
-
Edited by Dzmitry (Dima) Meshcharakou