Commit 9ae92b8c authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Add cop to make sure we don't use ivar in a module

parent 4cadf22e
# rubocop:disable Cop/ModuleWithInstanceVariables
module BoardsResponses
def authorize_read_list
authorize_action_for!(board.parent, :read_list)
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module CreatesCommit
extend ActiveSupport::Concern
......
module CycleAnalyticsParams
extend ActiveSupport::Concern
# rubocop:disable Cop/ModuleWithInstanceVariables
def options(params)
@options ||= { from: start_date(params), current_user: current_user }
end
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module IssuableActions
extend ActiveSupport::Concern
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module IssuableCollections
extend ActiveSupport::Concern
include SortingHelper
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module IssuesAction
extend ActiveSupport::Concern
include IssuableCollections
......
......@@ -90,6 +90,7 @@ def build_can_download_code?
has_authentication_ability?(:build_download_code) && can?(user, :build_download_code, project)
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def storage_project
@storage_project ||= begin
result = project
......@@ -103,6 +104,7 @@ def storage_project
end
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def objects
@objects ||= (params[:objects] || []).to_a
end
......
......@@ -76,6 +76,7 @@ def members_page_url
end
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def source_type
@source_type ||= membershipable.class.to_s.humanize(capitalize: false)
end
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module MergeRequestsAction
extend ActiveSupport::Concern
include IssuableCollections
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module MilestoneActions
extend ActiveSupport::Concern
......
# rubocop:disable Cop/ModuleWithInstanceVariables
module NotesActions
include RendersNotes
extend ActiveSupport::Concern
......
......@@ -13,6 +13,7 @@ def prepare_scopes
end
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def load_scopes
@scopes = Doorkeeper.configuration.scopes
end
......
module RendersCommits
# rubocop:disable Cop/ModuleWithInstanceVariables
def prepare_commits_for_rendering(commits)
Banzai::CommitRenderer.render(commits, @project, current_user)
......
module RendersNotes
# rubocop:disable Cop/ModuleWithInstanceVariables
def prepare_notes_for_rendering(notes, noteable = nil)
preload_noteable_for_regular_notes(notes)
preload_max_access_for_authors(notes, @project)
......
......@@ -17,6 +17,7 @@ def client_ip_whitelisted?
ip_whitelist.any? { |e| e.include?(Gitlab::RequestContext.client_ip) }
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def ip_whitelist
@ip_whitelist ||= Settings.monitoring.ip_whitelist.map(&IPAddr.method(:new))
end
......
......@@ -65,6 +65,7 @@ module ServiceParams
# Parameters to ignore if no value is specified
FILTER_BLANK_PARAMS = [:password].freeze
# rubocop:disable Cop/ModuleWithInstanceVariables
def service_params
dynamic_params = @service.event_channel_names + @service.event_names
service_params = params.permit(:id, service: ALLOWED_PARAMS_CE + dynamic_params)
......
......@@ -4,6 +4,7 @@ module SnippetsActions
def edit
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def raw
disposition = params[:inline] == 'false' ? 'attachment' : 'inline'
......
......@@ -17,6 +17,7 @@ def mark_as_spam
private
# rubocop:disable Cop/ModuleWithInstanceVariables
def ensure_spam_config_loaded!
return @spam_config_loaded if defined?(@spam_config_loaded)
......
......@@ -11,6 +11,7 @@ def toggle_subscription
private
# rubocop:disable Cop/ModuleWithInstanceVariables
def subscribable_project
@project || raise(NotImplementedError)
end
......
......@@ -17,6 +17,7 @@ def columns
super.reject { |column| ignored_columns.include?(column.name) }
end
# rubocop:disable Cop/ModuleWithInstanceVariables
def ignored_columns
@ignored_columns ||= Set.new
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment