Commit 56afdbb9 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '346031-Fix-GraphQL/FieldMethod-offense' into 'master'

Fix GraphQL/FieldMethod offense (Part 1/2)

See merge request gitlab-org/gitlab!76020
parents 106795c6 ff8b0e5b
---
GraphQL/FieldMethod:
Exclude:
- app/graphql/types/ci/job_type.rb
- app/graphql/types/merge_request_type.rb
- app/graphql/types/metrics/dashboards/annotation_type.rb
- app/graphql/types/packages/package_details_type.rb
- app/graphql/types/project_type.rb
......@@ -61,7 +61,7 @@ module Types
field :coverage, GraphQL::Types::Float, null: true,
description: 'Coverage level of the job.'
field :created_by_tag, GraphQL::Types::Boolean, null: false,
description: 'Whether the job was created by a tag.'
description: 'Whether the job was created by a tag.', method: :tag?
field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the job.'
field :downstream_pipeline, Types::Ci::PipelineType, null: true,
......@@ -173,10 +173,6 @@ module Types
object&.coverage
end
def created_by_tag
object.tag?
end
def manual_job
object.try(:action?)
end
......
......@@ -179,7 +179,7 @@ module Types
description: 'Total time reported as spent on the merge request.'
field :approved_by, Types::UserType.connection_type, null: true,
description: 'Users who approved the merge request.'
description: 'Users who approved the merge request.', method: :approved_by_users
field :auto_merge_strategy, GraphQL::Types::String, null: true,
description: 'Selected auto merge strategy.'
field :available_auto_merge_strategies, [GraphQL::Types::String], null: true, calls_gitaly: true,
......@@ -208,10 +208,6 @@ module Types
markdown_field :title_html, null: true
markdown_field :description_html, null: true
def approved_by
object.approved_by_users
end
def user_notes_count
BatchLoader::GraphQL.for(object.id).batch(key: :merge_request_user_notes_count) do |ids, loader, args|
counts = Note.count_for_collection(ids, 'MergeRequest').index_by(&:noteable_id)
......
......@@ -14,17 +14,14 @@ module Types
description: 'ID of the annotation.'
field :panel_id, GraphQL::Types::String, null: true,
description: 'ID of a dashboard panel to which the annotation should be scoped.'
description: 'ID of a dashboard panel to which the annotation should be scoped.',
method: :panel_xid
field :starting_at, Types::TimeType, null: true,
description: 'Timestamp marking start of annotated time span.'
field :ending_at, Types::TimeType, null: true,
description: 'Timestamp marking end of annotated time span.'
def panel_id
object.panel_xid
end
end
end
end
......
......@@ -32,10 +32,10 @@ module Types
field :tag_list, GraphQL::Types::String, null: true,
deprecated: { reason: 'Use `topics`', milestone: '13.12' },
description: 'List of project topics (not Git tags).'
description: 'List of project topics (not Git tags).', method: :topic_list
field :topics, [GraphQL::Types::String], null: true,
description: 'List of project topics.'
description: 'List of project topics.', method: :topic_list
field :http_url_to_repo, GraphQL::Types::String, null: true,
description: 'URL to connect to the project via HTTPS.'
......@@ -461,14 +461,6 @@ module Types
object.service_desk_address
end
def tag_list
object.topic_list
end
def topics
object.topic_list
end
private
def project
......
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