Commit 47b30384 authored by gfyoung's avatar gfyoung

Enable frozen string in app/graphql + app/finders

Partially addresses #47424.
parent e91dc8f4
# frozen_string_literal: true
class AccessRequestsFinder
attr_accessor :source
......
# frozen_string_literal: true
class Admin::ProjectsFinder
attr_reader :params, :current_user
......
# frozen_string_literal: true
class BranchesFinder
def initialize(repository, params = {})
@repository = repository
......
# frozen_string_literal: true
class ClustersFinder
def initialize(project, user, scope)
@project = project
......
# frozen_string_literal: true
module CreatedAtFilter
def by_created_at(items)
items = items.created_before(params[:created_before]) if params[:created_before].present?
......
# frozen_string_literal: true
module CustomAttributesFilter
def by_custom_attributes(items)
return items unless params[:custom_attributes].is_a?(Hash)
......
# frozen_string_literal: true
module FinderMethods
def find_by!(*args)
raise_not_found_unless_authorized execute.find_by!(*args)
......
# frozen_string_literal: true
# Module to prepend into finders to specify wether or not the finder requires
# cross project access
#
......
# frozen_string_literal: true
class ContributedProjectsFinder < UnionFinder
def initialize(user)
@user = user
......
# frozen_string_literal: true
class EnvironmentsFinder
attr_reader :project, :current_user, :params
......
# frozen_string_literal: true
class EventsFinder
prepend FinderMethods
prepend FinderWithCrossProjectAccess
......
# frozen_string_literal: true
class ForkProjectsFinder < ProjectsFinder
def initialize(project, params: {}, current_user: nil)
project_ids = project.forks.includes(:creator).select(:id)
......
# frozen_string_literal: true
# GroupDescendantsFinder
#
# Used to find and filter all subgroups and projects of a passed parent group
......
# frozen_string_literal: true
class GroupFinder
include Gitlab::Allowable
......
# frozen_string_literal: true
class GroupMembersFinder
def initialize(group)
@group = group
......
# frozen_string_literal: true
# GroupProjectsFinder
#
# Used to filter Projects by set of params
......
# frozen_string_literal: true
# GroupsFinder
#
# Used to filter Groups by a set of params
......
# frozen_string_literal: true
# IssuableFinder
#
# Used to filter Issues and MergeRequests collections by set of params
......
# frozen_string_literal: true
# Finders::Issues class
#
# Used to filter Issues collections by set of params
......
# frozen_string_literal: true
class JoinedGroupsFinder < UnionFinder
def initialize(user)
@user = user
......
# frozen_string_literal: true
class LabelsFinder < UnionFinder
prepend FinderWithCrossProjectAccess
include FinderMethods
......
# frozen_string_literal: true
# LicenseTemplateFinder
#
# Used to find license templates, which may come from a variety of external
......
# frozen_string_literal: true
class MembersFinder
attr_reader :project, :current_user, :group
......
# frozen_string_literal: true
class MergeRequestTargetProjectFinder
include FinderMethods
......
# frozen_string_literal: true
# Finders::MergeRequest class
#
# Used to filter MergeRequests collections by set of params
......
# frozen_string_literal: true
# Search for milestones
#
# params - Hash
......
# frozen_string_literal: true
class NotesFinder
FETCH_OVERLAP = 5.seconds
......
# frozen_string_literal: true
class PersonalAccessTokensFinder
attr_accessor :params
......
# frozen_string_literal: true
class PersonalProjectsFinder < UnionFinder
include Gitlab::Allowable
......
# frozen_string_literal: true
class PipelineSchedulesFinder
attr_reader :project, :pipeline_schedules
......
# frozen_string_literal: true
class PipelinesFinder
attr_reader :project, :pipelines, :params, :current_user
......
# frozen_string_literal: true
# ProjectsFinder
#
# Used to filter Projects by set of params
......
# frozen_string_literal: true
class RunnerJobsFinder
attr_reader :runner, :params
......
# frozen_string_literal: true
# Snippets Finder
#
# Used to filter Snippets collections by a set of params
......
# frozen_string_literal: true
class TagsFinder
def initialize(repository, params)
@repository = repository
......
# frozen_string_literal: true
class TemplateFinder
VENDORED_TEMPLATES = {
dockerfiles: ::Gitlab::Template::DockerfileTemplate,
......
# frozen_string_literal: true
# TodosFinder
#
# Used to filter Todos by set of params
......
# frozen_string_literal: true
class UnionFinder
def find_union(segments, klass)
if segments.length > 1
......
# frozen_string_literal: true
# Get user activity feed for projects common for a user and a logged in user
#
# - current_user: The user viewing the events
......
# frozen_string_literal: true
# UsersFinder
#
# Used to filter users by set of params
......
# frozen_string_literal: true
module Functions
class BaseFunction < GraphQL::Function
end
......
# frozen_string_literal: true
module Functions
class Echo < BaseFunction
argument :text, GraphQL::STRING_TYPE
......
# frozen_string_literal: true
class GitlabSchema < GraphQL::Schema
use BatchLoader::GraphQL
use Gitlab::Graphql::Authorize
......
# frozen_string_literal: true
module Mutations
module ResolvesProject
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Mutations
module MergeRequests
class Base < BaseMutation
......
# frozen_string_literal: true
module Resolvers
class BaseResolver < GraphQL::Schema::Resolver
end
......
# frozen_string_literal: true
module ResolvesPipelines
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Resolvers
module FullPathResolver
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Resolvers
class MergeRequestPipelinesResolver < BaseResolver
include ::ResolvesPipelines
......
# frozen_string_literal: true
module Resolvers
class MergeRequestResolver < BaseResolver
argument :iid, GraphQL::ID_TYPE,
......
# frozen_string_literal: true
module Resolvers
class ProjectPipelinesResolver < BaseResolver
include ResolvesPipelines
......
# frozen_string_literal: true
module Resolvers
class ProjectResolver < BaseResolver
prepend FullPathResolver
......
# frozen_string_literal: true
module Types
class BaseEnum < GraphQL::Schema::Enum
end
......
# frozen_string_literal: true
module Types
class BaseField < GraphQL::Schema::Field
prepend Gitlab::Graphql::Authorize
......
# frozen_string_literal: true
module Types
class BaseInputObject < GraphQL::Schema::InputObject
end
......
# frozen_string_literal: true
module Types
module BaseInterface
include GraphQL::Schema::Interface
......
# frozen_string_literal: true
module Types
class BaseObject < GraphQL::Schema::Object
prepend Gitlab::Graphql::Present
......
# frozen_string_literal: true
module Types
class BaseScalar < GraphQL::Schema::Scalar
end
......
# frozen_string_literal: true
module Types
class BaseUnion < GraphQL::Schema::Union
end
......
# frozen_string_literal: true
module Types
module Ci
class PipelineStatusEnum < BaseEnum
......
# frozen_string_literal: true
module Types
module Ci
class PipelineType < BaseObject
......
# frozen_string_literal: true
module Types
class MergeRequestType < BaseObject
expose_permissions Types::PermissionTypes::MergeRequest
......
# frozen_string_literal: true
module Types
module PermissionTypes
class BasePermissionType < BaseObject
......
# frozen_string_literal: true
module Types
module PermissionTypes
module Ci
......
# frozen_string_literal: true
module Types
module PermissionTypes
class MergeRequest < BasePermissionType
......
# frozen_string_literal: true
module Types
module PermissionTypes
class Project < BasePermissionType
......
# frozen_string_literal: true
module Types
class ProjectType < BaseObject
expose_permissions Types::PermissionTypes::Project
......
# frozen_string_literal: true
module Types
class QueryType < BaseObject
graphql_name 'Query'
......
# frozen_string_literal: true
module Types
class TimeType < BaseScalar
graphql_name 'Time'
......
---
title: Enable frozen string in app/graphql + app/finders
merge_request:
author: gfyoung
type: performance
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