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