Add cop to guard use of Gitlab::SaaS.feature_available?
Description of the proposal
Add cop to guard use of Gitlab::SaaS.feature_available? outside of /ee
- alert if used in FOSS/ce(outside of ee).
- Enforces https://docs.gitlab.com/development/ee_features/#do-not-use-saas-only-features-for-functionality-in-ce
# Checks for use of Gitlab::Saas.feature_available? outside of the /ee directory.
#
# @example
#
# # bad (outside /ee directory)
# if Gitlab::Saas.feature_available?(:some_feature)
# # do something
# end
#
# # bad (outside /ee directory with safe navigation)
# if Gitlab::Saas&.feature_available?(:some_feature)
# # do something
# end
#
# # good (inside /ee directory)
# if Gitlab::Saas.feature_available?(:some_feature)
# # do something
# end
#
- see #575615
Check-list
-
Make sure this MR enables a static analysis check rule for new usage but ignores current offenses. -
Create a follow-up issue to fix the current offenses as a separate iteration: #575615 -
Follow the review process as usual.
Edited by Doug Stull