Skip to content

Discourage use of Current.organization outside of approved app layers

Doug Stull requested to merge 442751-ban-current-organization-in-places into master

Description of the proposal

Discourage use of Current.organization outside of approved app layers

  • add rubocop to lint on use of Current.organization outside of approved app layers.
  • see #442751 (closed) for details
      # # bad
      # class SomeService
      #   def execute
      #     do_something_with(Current.organization)
      #   end
      # end
      #
      # # good
      # class SomeController < ApplicationController
      #   def create
      #     response = SomeService.new(organization: Current.organization).execute
      #   end
      # end
      #
      # class SomeService
      #   def initialize(organization:)
      #     @organization = organization
      #   end
      #
      #   def execute
      #     do_something_with(@organization)
      #   end
      # end

Check-list

  • Mention this proposal in the relevant Slack channels (e.g. #development, #backend, #frontend)
    • handled by discussion in the related issue
  • The MR doesn't have significant objections, and is getting a majority of 👍 vs 👎 (remember that we don't need to reach a consensus)
  • Follow the review process as usual

Related to #442751 (closed)

Edited by Doug Stull

Merge request reports