Commit 411711dc authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '346029-Fix-GraphQL/FieldDefinitions-offense-(Part-4/4)' into 'master'

Fix GraphQL/FieldDefinitions offense (Part 4/4)

See merge request gitlab-org/gitlab!76017
parents 5f556b48 f06a2c46
---
GraphQL/FieldDefinitions:
Exclude:
- ee/app/graphql/types/ci/code_quality_degradation_type.rb
- ee/app/graphql/types/epic_type.rb
- ee/app/graphql/types/group_release_stats_type.rb
- ee/app/graphql/types/iteration_type.rb
- ee/app/graphql/types/requirements_management/requirement_type.rb
- ee/app/graphql/types/vulnerability_type.rb
......@@ -23,13 +23,13 @@ module Types
field :path, GraphQL::Types::String, null: false,
description: 'Relative path to the file containing the code quality degradation.'
field :line, GraphQL::Types::Int, null: false,
description: 'Line on which the code quality degradation occurred.'
def path
degradation.dig(:location, :path)
end
field :line, GraphQL::Types::Int, null: false,
description: 'Line on which the code quality degradation occurred.'
def line
degradation.dig(:location, :lines, :begin) || degradation.dig(:location, :positions, :begin, :line)
end
......
......@@ -24,10 +24,8 @@ module Types
description: 'Internal ID of the epic.'
field :title, GraphQL::Types::String, null: true,
description: 'Title of the epic.'
markdown_field :title_html, null: true
field :description, GraphQL::Types::String, null: true,
description: 'Description of the epic.'
markdown_field :description_html, null: true
field :state, EpicStateEnum, null: false,
description: 'State of the epic.'
field :confidential, GraphQL::Types::Boolean, null: true,
......@@ -162,6 +160,9 @@ module Types
resolver: ::Resolvers::EpicAncestorsResolver,
description: 'Ancestors (parents) of the epic.'
markdown_field :title_html, null: true
markdown_field :description_html, null: true
def has_children?
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(context, object.id, COUNT) do |node, _aggregate_object|
node.children.any?
......
......@@ -25,7 +25,6 @@ module Types
field :description, GraphQL::Types::String, null: true,
description: 'Description of the iteration.'
markdown_field :description_html, null: true
field :state, Types::IterationStateEnum, null: false,
description: 'State of the iteration.'
......@@ -57,6 +56,8 @@ module Types
field :iteration_cadence, Types::Iterations::CadenceType, null: false,
description: 'Cadence of the iteration.'
markdown_field :description_html, null: true
def iteration_cadence
::Gitlab::Graphql::Loaders::BatchModelLoader.new(::Iterations::Cadence, object.iterations_cadence_id).find
end
......
......@@ -18,11 +18,9 @@ module Types
field :title, GraphQL::Types::String, null: true,
description: 'Title of the requirement.'
markdown_field :title_html, null: true
field :description, GraphQL::Types::String, null: true,
description: 'Description of the requirement.'
markdown_field :description_html, null: true
field :state, RequirementsManagement::RequirementStateEnum, null: false,
description: 'State of the requirement.'
......@@ -52,6 +50,9 @@ module Types
field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of when the requirement was last updated.'
markdown_field :title_html, null: true
markdown_field :description_html, null: true
def project
Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find
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