Skip to content

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

      # 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
      #

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

Merge request reports

Loading