Class: Gitlab::Search::AbuseDetection

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, AbuseValidators
Defined in:
lib/gitlab/search/abuse_detection.rb

Constant Summary collapse

ABUSIVE_TERM_SIZE =
100
ALLOWED_CHARS_REGEX =
%r{\A[[:alnum:]_\-\/\.!]+\z}
ALLOWED_SCOPES =
%w[
  blobs
  code
  commits
  epics
  issues
  merge_requests
  milestones
  notes
  projects
  snippet_titles
  users
  wiki_blobs
].freeze
READABLE_PARAMS =
%i[
  group_id
  project_id
  project_ref
  query_string
  repository_ref
  scope
].freeze
STOP_WORDS =
%w[
  a an and are as at be but by for if in into is it no not of on or such that the their then there these they this to was will with
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ AbuseDetection

Returns a new instance of AbuseDetection.



62
63
64
# File 'lib/gitlab/search/abuse_detection.rb', line 62

def initialize(params)
  READABLE_PARAMS.each { |p| instance_variable_set("@#{p}", params[p]) }
end