Commit c9d6d99d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'issue_346033_1/6' into 'master'

Fix GraphQL/OrderedFields offenses

See merge request gitlab-org/gitlab!81469
parents 6b211f9e 321b3ca2
......@@ -16,94 +16,96 @@ module Types
present_using MergeRequestPresenter
field :created_at, Types::TimeType, null: false,
description: 'Timestamp of when the merge request was created.'
field :description, GraphQL::Types::String, null: true,
description: 'Description of the merge request (Markdown rendered as HTML for caching).'
field :diff_head_sha, GraphQL::Types::String, null: true,
description: 'Diff head SHA of the merge request.'
field :diff_refs, Types::DiffRefsType, null: true,
description: 'References of the base SHA, the head SHA, and the start SHA for this merge request.'
field :diff_stats, [Types::DiffStatsType], null: true, calls_gitaly: true,
description: 'Details about which files were changed in this merge request.' do
argument :path, GraphQL::Types::String, required: false, description: 'Specific file path.'
end
field :draft, GraphQL::Types::Boolean, method: :draft?, null: false,
description: 'Indicates if the merge request is a draft.'
field :id, GraphQL::Types::ID, null: false,
description: 'ID of the merge request.'
field :iid, GraphQL::Types::String, null: false,
description: 'Internal ID of the merge request.'
field :title, GraphQL::Types::String, null: false,
description: 'Title of the merge request.'
field :description, GraphQL::Types::String, null: true,
description: 'Description of the merge request (Markdown rendered as HTML for caching).'
field :state, MergeRequestStateEnum, null: false,
description: 'State of the merge request.'
field :created_at, Types::TimeType, null: false,
description: 'Timestamp of when the merge request was created.'
field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of when the merge request was last updated.'
field :merge_when_pipeline_succeeds, GraphQL::Types::Boolean, null: true,
description: 'Indicates if the merge has been set to be merged when its pipeline succeeds (MWPS).'
field :merged_at, Types::TimeType, null: true, complexity: 5,
description: 'Timestamp of when the merge request was merged, null if not merged.'
field :source_project, Types::ProjectType, null: true,
description: 'Source project of the merge request.'
field :target_project, Types::ProjectType, null: false,
description: 'Target project of the merge request.'
field :diff_refs, Types::DiffRefsType, null: true,
description: 'References of the base SHA, the head SHA, and the start SHA for this merge request.'
field :project, Types::ProjectType, null: false,
description: 'Alias for target_project.'
field :project_id, GraphQL::Types::Int, null: false, method: :target_project_id,
description: 'ID of the merge request project.'
field :source_project_id, GraphQL::Types::Int, null: true,
description: 'ID of the merge request source project.'
field :target_project_id, GraphQL::Types::Int, null: false,
description: 'ID of the merge request target project.'
field :source_branch, GraphQL::Types::String, null: false,
description: 'Source branch of the merge request.'
field :source_branch_protected, GraphQL::Types::Boolean, null: false, calls_gitaly: true,
description: 'Indicates if the source branch is protected.'
field :source_project, Types::ProjectType, null: true,
description: 'Source project of the merge request.'
field :source_project_id, GraphQL::Types::Int, null: true,
description: 'ID of the merge request source project.'
field :state, MergeRequestStateEnum, null: false,
description: 'State of the merge request.'
field :target_branch, GraphQL::Types::String, null: false,
description: 'Target branch of the merge request.'
field :draft, GraphQL::Types::Boolean, method: :draft?, null: false,
description: 'Indicates if the merge request is a draft.'
field :merge_when_pipeline_succeeds, GraphQL::Types::Boolean, null: true,
description: 'Indicates if the merge has been set to be merged when its pipeline succeeds (MWPS).'
field :diff_head_sha, GraphQL::Types::String, null: true,
description: 'Diff head SHA of the merge request.'
field :diff_stats, [Types::DiffStatsType], null: true, calls_gitaly: true,
description: 'Details about which files were changed in this merge request.' do
argument :path, GraphQL::Types::String, required: false, description: 'Specific file path.'
end
field :target_project, Types::ProjectType, null: false,
description: 'Target project of the merge request.'
field :target_project_id, GraphQL::Types::Int, null: false,
description: 'ID of the merge request target project.'
field :title, GraphQL::Types::String, null: false,
description: 'Title of the merge request.'
field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of when the merge request was last updated.'
field :allow_collaboration, GraphQL::Types::Boolean, null: true,
description: 'Indicates if members of the target project can push to the fork.'
field :default_merge_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default merge commit message of the merge request.'
field :default_merge_commit_message_with_description, GraphQL::Types::String, null: true,
description: 'Default merge commit message of the merge request with description. Will have the same value as `defaultMergeCommitMessage` when project has `mergeCommitTemplate` set.',
deprecated: { reason: 'Define merge commit template in project and use `defaultMergeCommitMessage`', milestone: '14.5' }
field :default_squash_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default squash commit message of the merge request.'
field :diff_stats_summary, Types::DiffStatsSummaryType, null: true, calls_gitaly: true,
description: 'Summary of which files were changed in this merge request.'
field :merge_commit_sha, GraphQL::Types::String, null: true,
description: 'SHA of the merge request commit (set once merged).'
field :user_notes_count, GraphQL::Types::Int, null: true,
description: 'User notes count of the merge request.',
resolver: Resolvers::UserNotesCountResolver
field :user_discussions_count, GraphQL::Types::Int, null: true,
description: 'Number of user discussions in the merge request.',
resolver: Resolvers::UserDiscussionsCountResolver
field :should_remove_source_branch, GraphQL::Types::Boolean, method: :should_remove_source_branch?, null: true,
description: 'Indicates if the source branch of the merge request will be deleted after merge.'
field :diverged_from_target_branch, GraphQL::Types::Boolean,
null: false, calls_gitaly: true,
method: :diverged_from_target_branch?,
description: 'Indicates if the source branch is behind the target branch.'
field :downvotes, GraphQL::Types::Int, null: false,
description: 'Number of downvotes for the merge request.'
field :force_remove_source_branch, GraphQL::Types::Boolean, method: :force_remove_source_branch?, null: true,
description: 'Indicates if the project settings will lead to source branch deletion after merge.'
field :in_progress_merge_commit_sha, GraphQL::Types::String, null: true,
description: 'Commit SHA of the merge request if merge is in progress.'
field :merge_commit_sha, GraphQL::Types::String, null: true,
description: 'SHA of the merge request commit (set once merged).'
field :merge_error, GraphQL::Types::String, null: true,
description: 'Error message due to a merge error.'
field :merge_ongoing, GraphQL::Types::Boolean, method: :merge_ongoing?, null: false,
description: 'Indicates if a merge is currently occurring.'
field :merge_status, GraphQL::Types::String, method: :public_merge_status, null: true,
description: 'Status of the merge request.',
deprecated: { reason: :renamed, replacement: 'MergeRequest.mergeStatusEnum', milestone: '14.0' }
field :merge_status_enum, ::Types::MergeRequests::MergeStatusEnum,
method: :public_merge_status, null: true,
description: 'Merge status of the merge request.'
field :in_progress_merge_commit_sha, GraphQL::Types::String, null: true,
description: 'Commit SHA of the merge request if merge is in progress.'
field :merge_error, GraphQL::Types::String, null: true,
description: 'Error message due to a merge error.'
field :allow_collaboration, GraphQL::Types::Boolean, null: true,
description: 'Indicates if members of the target project can push to the fork.'
field :should_be_rebased, GraphQL::Types::Boolean, method: :should_be_rebased?, null: false, calls_gitaly: true,
description: 'Indicates if the merge request will be rebased.'
field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true,
description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.'
field :rebase_commit_sha, GraphQL::Types::String, null: true,
description: 'Rebase commit SHA of the merge request.'
field :rebase_in_progress, GraphQL::Types::Boolean, method: :rebase_in_progress?, null: false, calls_gitaly: true,
description: 'Indicates if there is a rebase currently in progress for the merge request.'
field :default_merge_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default merge commit message of the merge request.'
field :default_merge_commit_message_with_description, GraphQL::Types::String, null: true,
description: 'Default merge commit message of the merge request with description. Will have the same value as `defaultMergeCommitMessage` when project has `mergeCommitTemplate` set.',
deprecated: { reason: 'Define merge commit template in project and use `defaultMergeCommitMessage`', milestone: '14.5' }
field :default_squash_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true,
description: 'Default squash commit message of the merge request.'
field :merge_ongoing, GraphQL::Types::Boolean, method: :merge_ongoing?, null: false,
description: 'Indicates if a merge is currently occurring.'
field :should_be_rebased, GraphQL::Types::Boolean, method: :should_be_rebased?, null: false, calls_gitaly: true,
description: 'Indicates if the merge request will be rebased.'
field :should_remove_source_branch, GraphQL::Types::Boolean, method: :should_remove_source_branch?, null: true,
description: 'Indicates if the source branch of the merge request will be deleted after merge.'
field :source_branch_exists, GraphQL::Types::Boolean,
null: false, calls_gitaly: true,
method: :source_branch_exists?,
......@@ -112,18 +114,16 @@ module Types
null: false, calls_gitaly: true,
method: :target_branch_exists?,
description: 'Indicates if the target branch of the merge request exists.'
field :diverged_from_target_branch, GraphQL::Types::Boolean,
null: false, calls_gitaly: true,
method: :diverged_from_target_branch?,
description: 'Indicates if the source branch is behind the target branch.'
field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true,
description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.'
field :web_url, GraphQL::Types::String, null: true,
description: 'Web URL of the merge request.'
field :upvotes, GraphQL::Types::Int, null: false,
description: 'Number of upvotes for the merge request.'
field :downvotes, GraphQL::Types::Int, null: false,
description: 'Number of downvotes for the merge request.'
field :user_discussions_count, GraphQL::Types::Int, null: true,
description: 'Number of user discussions in the merge request.',
resolver: Resolvers::UserDiscussionsCountResolver
field :user_notes_count, GraphQL::Types::Int, null: true,
description: 'User notes count of the merge request.',
resolver: Resolvers::UserNotesCountResolver
field :web_url, GraphQL::Types::String, null: true,
description: 'Web URL of the merge request.'
field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline,
description: 'Pipeline running on the branch HEAD of the merge request.'
......@@ -132,74 +132,74 @@ module Types
description: 'Pipelines for the merge request. Note: for performance reasons, no more than the most recent 500 pipelines will be returned.',
resolver: Resolvers::MergeRequestPipelinesResolver
field :milestone, Types::MilestoneType, null: true,
description: 'Milestone of the merge request.'
field :assignees,
type: Types::MergeRequests::AssigneeType.connection_type,
null: true,
complexity: 5,
description: 'Assignees of the merge request.'
field :reviewers,
type: Types::MergeRequests::ReviewerType.connection_type,
null: true,
complexity: 5,
description: 'Users from whom a review has been requested.'
field :author, Types::UserType, null: true,
description: 'User who created this merge request.'
field :participants, Types::UserType.connection_type, null: true, complexity: 15,
description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.',
resolver: Resolvers::Users::ParticipantsResolver
field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5,
description: 'Indicates if the currently logged in user is subscribed to this merge request.'
field :labels, Types::LabelType.connection_type, null: true, complexity: 5,
description: 'Labels of the merge request.'
field :discussion_locked, GraphQL::Types::Boolean,
description: 'Indicates if comments on the merge request are locked to members only.',
null: false
field :time_estimate, GraphQL::Types::Int, null: false,
description: 'Time estimate of the merge request.'
field :total_time_spent, GraphQL::Types::Int, null: false,
description: 'Total time reported as spent on the merge request.'
field :human_time_estimate, GraphQL::Types::String, null: true,
description: 'Human-readable time estimate of the merge request.'
field :human_total_time_spent, GraphQL::Types::String, null: true,
description: 'Human-readable total time reported as spent on the merge request.'
field :labels, Types::LabelType.connection_type, null: true, complexity: 5,
description: 'Labels of the merge request.'
field :milestone, Types::MilestoneType, null: true,
description: 'Milestone of the merge request.'
field :participants, Types::UserType.connection_type, null: true, complexity: 15,
description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.',
resolver: Resolvers::Users::ParticipantsResolver
field :reference, GraphQL::Types::String, null: false, method: :to_reference,
description: 'Internal reference of the merge request. Returned in shortened format by default.' do
argument :full, GraphQL::Types::Boolean, required: false, default_value: false,
description: 'Boolean option specifying whether the reference should be returned in full.'
end
field :task_completion_status, Types::TaskCompletionStatus, null: false,
description: Types::TaskCompletionStatus.description
field :auto_merge_enabled, GraphQL::Types::Boolean, null: false,
description: 'Indicates if auto merge is enabled for the merge request.'
field :commit_count, GraphQL::Types::Int, null: true, method: :commits_count,
description: 'Number of commits in the merge request.'
field :conflicts, GraphQL::Types::Boolean, null: false, method: :cannot_be_merged?,
description: 'Indicates if the merge request has conflicts.'
field :auto_merge_enabled, GraphQL::Types::Boolean, null: false,
description: 'Indicates if auto merge is enabled for the merge request.'
field :reviewers,
type: Types::MergeRequests::ReviewerType.connection_type,
null: true,
complexity: 5,
description: 'Users from whom a review has been requested.'
field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5,
description: 'Indicates if the currently logged in user is subscribed to this merge request.'
field :task_completion_status, Types::TaskCompletionStatus, null: false,
description: Types::TaskCompletionStatus.description
field :time_estimate, GraphQL::Types::Int, null: false,
description: 'Time estimate of the merge request.'
field :total_time_spent, GraphQL::Types::Int, null: false,
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.'
field :squash_on_merge, GraphQL::Types::Boolean, null: false, method: :squash_on_merge?,
description: 'Indicates if squash on merge is enabled.'
field :squash, GraphQL::Types::Boolean, null: false,
description: 'Indicates if squash on merge is enabled.'
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,
description: 'Array of available auto merge strategies.'
field :has_ci, GraphQL::Types::Boolean, null: false, method: :has_ci?,
description: 'Indicates if the merge request has CI.'
field :mergeable, GraphQL::Types::Boolean, null: false, method: :mergeable?, calls_gitaly: true,
description: 'Indicates if the merge request is mergeable.'
field :commits, Types::CommitType.connection_type, null: true,
calls_gitaly: true, description: 'Merge request commits.'
field :commits_without_merge_commits, Types::CommitType.connection_type, null: true,
calls_gitaly: true, description: 'Merge request commits excluding merge commits.'
field :security_auto_fix, GraphQL::Types::Boolean, null: true,
description: 'Indicates if the merge request is created by @GitLab-Security-Bot.'
field :auto_merge_strategy, GraphQL::Types::String, null: true,
description: 'Selected auto merge strategy.'
field :has_ci, GraphQL::Types::Boolean, null: false, method: :has_ci?,
description: 'Indicates if the merge request has CI.'
field :merge_user, Types::UserType, null: true,
description: 'User who merged this merge request or set it to merge when pipeline succeeds.'
field :mergeable, GraphQL::Types::Boolean, null: false, method: :mergeable?, calls_gitaly: true,
description: 'Indicates if the merge request is mergeable.'
field :security_auto_fix, GraphQL::Types::Boolean, null: true,
description: 'Indicates if the merge request is created by @GitLab-Security-Bot.'
field :squash, GraphQL::Types::Boolean, null: false,
description: 'Indicates if squash on merge is enabled.'
field :squash_on_merge, GraphQL::Types::Boolean, null: false, method: :squash_on_merge?,
description: 'Indicates if squash on merge is enabled.'
field :timelogs, Types::TimelogType.connection_type, null: false,
description: 'Timelogs on the merge request.'
......
......@@ -9,10 +9,10 @@ module Types
field :enabled, GraphQL::Types::Boolean, null: false,
description: 'Indicates whether the Kubernetes Agent Server is enabled.'
field :version, GraphQL::Types::String, null: true,
description: 'KAS version.'
field :external_url, GraphQL::Types::String, null: true,
description: 'URL used by the Agents to communicate with KAS.'
field :version, GraphQL::Types::String, null: true,
description: 'KAS version.'
end
end
end
......@@ -6,11 +6,11 @@ module Types
authorize :read_instance_metadata
field :version, GraphQL::Types::String, null: false,
description: 'Version.'
field :revision, GraphQL::Types::String, null: false,
description: 'Revision.'
field :kas, ::Types::Metadata::KasType, null: false,
description: 'Metadata about KAS.'
field :revision, GraphQL::Types::String, null: false,
description: 'Revision.'
field :version, GraphQL::Types::String, null: false,
description: 'Version.'
end
end
......@@ -8,9 +8,9 @@ module Types
authorize :read_package_settings
field :maven_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate Maven packages are allowed for this namespace.'
field :maven_duplicate_exception_regex, Types::UntrustedRegexp, null: true, description: 'When maven_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.'
field :generic_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate generic packages are allowed for this namespace.'
field :generic_duplicate_exception_regex, Types::UntrustedRegexp, null: true, description: 'When generic_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.'
field :generic_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate generic packages are allowed for this namespace.'
field :maven_duplicate_exception_regex, Types::UntrustedRegexp, null: true, description: 'When maven_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.'
field :maven_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate Maven packages are allowed for this namespace.'
end
end
......@@ -9,14 +9,14 @@ module Types
field :id, GraphQL::Types::ID, null: false,
description: 'ID of the namespace.'
field :name, GraphQL::Types::String, null: false,
description: 'Name of the namespace.'
field :path, GraphQL::Types::String, null: false,
description: 'Path of the namespace.'
field :full_name, GraphQL::Types::String, null: false,
description: 'Full name of the namespace.'
field :full_path, GraphQL::Types::ID, null: false,
description: 'Full path of the namespace.'
field :name, GraphQL::Types::String, null: false,
description: 'Name of the namespace.'
field :path, GraphQL::Types::String, null: false,
description: 'Path of the namespace.'
field :cross_project_pipeline_available, GraphQL::Types::Boolean, null: false,
resolver_method: :cross_project_pipeline_available?,
......@@ -25,12 +25,12 @@ module Types
field :description, GraphQL::Types::String, null: true,
description: 'Description of the namespace.'
field :visibility, GraphQL::Types::String, null: true,
description: 'Visibility of the namespace.'
field :lfs_enabled, GraphQL::Types::Boolean, null: true, method: :lfs_enabled?,
description: 'Indicates if Large File Storage (LFS) is enabled for namespace.'
field :request_access_enabled, GraphQL::Types::Boolean, null: true,
description: 'Indicates if users can request access to namespace.'
field :visibility, GraphQL::Types::String, null: true,
description: 'Visibility of the namespace.'
field :root_storage_statistics, Types::RootStorageStatisticsType,
null: true,
......
......@@ -12,28 +12,28 @@ module Types
field :file_path, GraphQL::Types::String, null: false,
description: 'Path of the file that was changed.'
field :old_path, GraphQL::Types::String, null: true,
description: 'Path of the file on the start SHA.'
field :new_path, GraphQL::Types::String, null: true,
description: 'Path of the file on the HEAD SHA.'
field :old_path, GraphQL::Types::String, null: true,
description: 'Path of the file on the start SHA.'
field :position_type, Types::Notes::PositionTypeEnum, null: false,
description: 'Type of file the position refers to.'
# Fields for text positions
field :old_line, GraphQL::Types::Int, null: true,
description: 'Line on start SHA that was changed.'
field :new_line, GraphQL::Types::Int, null: true,
description: 'Line on HEAD SHA that was changed.'
field :old_line, GraphQL::Types::Int, null: true,
description: 'Line on start SHA that was changed.'
# Fields for image positions
field :height, GraphQL::Types::Int, null: true,
description: 'Total height of the image.'
field :width, GraphQL::Types::Int, null: true,
description: 'Total width of the image.'
field :x, GraphQL::Types::Int, null: true,
description: 'X position of the note.'
field :y, GraphQL::Types::Int, null: true,
description: 'Y position of the note.'
field :width, GraphQL::Types::Int, null: true,
description: 'Total width of the image.'
field :height, GraphQL::Types::Int, null: true,
description: 'Total height of the image.'
def old_line
object.old_line if object.on_text?
......
......@@ -11,16 +11,16 @@ module Types
implements(Types::ResolvableInterface)
field :id, DiscussionID, null: false,
description: "ID of this discussion."
field :reply_id, DiscussionID, null: false,
description: 'ID used to reply to this discussion.'
field :created_at, Types::TimeType, null: false,
description: "Timestamp of the discussion's creation."
field :notes, Types::Notes::NoteType.connection_type, null: false,
description: 'All notes in the discussion.'
field :id, DiscussionID, null: false,
description: "ID of this discussion."
field :noteable, Types::NoteableType, null: true,
description: 'Object which the discussion belongs to.'
field :notes, Types::Notes::NoteType.connection_type, null: false,
description: 'All notes in the discussion.'
field :reply_id, DiscussionID, null: false,
description: 'ID used to reply to this discussion.'
# DiscussionID.coerce_result is suitable here, but will always mark this
# as being a 'Discussion'. Using `GlobalId.build` guarantees that we get
......
......@@ -33,17 +33,17 @@ module Types
method: :note,
description: 'Content of the note.'
field :confidential, GraphQL::Types::Boolean, null: true,
description: 'Indicates if this note is confidential.',
method: :confidential?
field :created_at, Types::TimeType, null: false,
description: 'Timestamp of the note creation.'
field :updated_at, Types::TimeType, null: false,
description: "Timestamp of the note's last activity."
field :discussion, Types::Notes::DiscussionType, null: true,
description: 'Discussion this note is a part of.'
field :position, Types::Notes::DiffPositionType, null: true,
description: 'Position of this note on a diff.'
field :confidential, GraphQL::Types::Boolean, null: true,
description: 'Indicates if this note is confidential.',
method: :confidential?
field :updated_at, Types::TimeType, null: false,
description: "Timestamp of the note's last activity."
field :url, GraphQL::Types::String,
null: true,
description: 'URL to view this Note in the Web UI.'
......
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