Skip to content
Snippets Groups Projects
Verified Commit 6e1be119 authored by Mohamed Hamda's avatar Mohamed Hamda :four: Committed by GitLab
Browse files

Merge branch '239356-Layout/LineLength-11' into 'master'

Fix Layout/LineLength offenses

See merge request !170704



Merged-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Approved-by: default avatarJustin Ho Tuan Duong <hduong@gitlab.com>
Approved-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Reviewed-by: default avatarJustin Ho Tuan Duong <hduong@gitlab.com>
Reviewed-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Co-authored-by: default avatarAlexander Ikonomou <alexander.ikonomou.19@proton.me>
parents c8da804a 21f7c2f0
No related branches found
No related tags found
1 merge request!170704Fix Layout/LineLength offenses
Pipeline #1525667299 passed
Showing
with 120 additions and 60 deletions
......@@ -122,22 +122,7 @@ Layout/LineLength:
- 'app/graphql/types/issue_sort_enum.rb'
- 'app/graphql/types/issue_type.rb'
- 'app/graphql/types/member_interface.rb'
- 'app/graphql/types/merge_request_type.rb'
- 'app/graphql/types/milestone_sort_enum.rb'
- 'app/graphql/types/milestone_type.rb'
- 'app/graphql/types/namespace/package_settings_type.rb'
- 'app/graphql/types/notes/diff_position_input_type.rb'
- 'app/graphql/types/notes/noteable_interface.rb'
- 'app/graphql/types/packages/composer/metadatum_type.rb'
- 'app/graphql/types/packages/conan/file_metadatum_type.rb'
- 'app/graphql/types/packages/helm/dependency_type.rb'
- 'app/graphql/types/packages/helm/metadata_type.rb'
- 'app/graphql/types/packages/nuget/dependency_link_metadatum_type.rb'
- 'app/graphql/types/packages/package_dependency_link_type.rb'
- 'app/graphql/types/packages/package_details_type.rb'
- 'app/graphql/types/packages/package_type_enum.rb'
- 'app/graphql/types/packages/pypi/metadatum_type.rb'
- 'app/graphql/types/project_type.rb'
- 'app/graphql/types/query_type.rb'
- 'app/graphql/types/repository/blob_type.rb'
- 'app/graphql/types/repository_type.rb'
......
......@@ -119,9 +119,9 @@ class MergeRequestType < BaseObject
alpha: { milestone: '16.5' },
calls_gitaly: true
field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true,
calls_gitaly: true,
description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.'
field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true, calls_gitaly: 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,
......@@ -163,7 +163,8 @@ class MergeRequestType < BaseObject
description: 'Pipeline running on the branch HEAD of the merge request.'
field :pipelines,
null: true,
description: 'Pipelines for the merge request. Note: for performance reasons, no more than the most recent 500 pipelines will be returned.',
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 :assignees,
......@@ -193,8 +194,12 @@ class MergeRequestType < BaseObject
description: 'Indicates if the merge request has conflicts.'
field :milestone, Types::MilestoneType, null: true,
description: 'Milestone of the merge request.'
field :participants, Types::MergeRequests::ParticipantType.connection_type, null: true, complexity: 15,
description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.',
field :participants,
Types::MergeRequests::ParticipantType.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
......@@ -240,11 +245,22 @@ class MergeRequestType < BaseObject
description: 'User who merged this merge request or set it to auto-merge.'
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.', deprecated: { reason: 'Security Auto Fix experiment feature was removed. It was always hidden behind `security_auto_fix` feature flag', milestone: '16.11' }
field :security_auto_fix,
GraphQL::Types::Boolean,
null: true,
description: 'Indicates if the merge request is created by @GitLab-Security-Bot.',
deprecated: {
reason: 'Security Auto Fix experiment feature was removed. ' \
'It was always hidden behind `security_auto_fix` feature flag',
milestone: '16.11'
}
field :squash, GraphQL::Types::Boolean, null: false,
description: 'Indicates if the merge request is set to be squashed when merged. [Project settings](https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html#configure-squash-options-for-a-project) may override this value. Use `squash_on_merge` instead to take project squash options into account.'
description: <<~HEREDOC.squish
Indicates if the merge request is set to be squashed when merged.
[Project settings](https://docs.gitlab.com/ee/user/project/merge_requests/squash_and_merge.html#configure-squash-options-for-a-project)
may override this value. Use `squash_on_merge` instead to take project squash options into account.
HEREDOC
field :squash_on_merge, GraphQL::Types::Boolean, null: false, method: :squash_on_merge?,
description: 'Indicates if the merge request will be squashed when merged.'
field :timelogs, Types::TimelogType.connection_type, null: false,
......@@ -296,7 +312,11 @@ def user_notes_count
def user_discussions_count
BatchLoader::GraphQL.for(object.id).batch(key: :merge_request_user_discussions_count) do |ids, loader, args|
counts = Note.count_for_collection(ids, 'MergeRequest', 'COUNT(DISTINCT discussion_id) as count').index_by(&:noteable_id)
counts = Note.count_for_collection(
ids,
'MergeRequest',
'COUNT(DISTINCT discussion_id) as count'
).index_by(&:noteable_id)
ids.each do |id|
loader.call(id, counts[id]&.count || 0)
......
......@@ -7,7 +7,13 @@ class MilestoneSortEnum < SortEnum
value 'DUE_DATE_ASC', 'Milestone due date by ascending order.', value: :due_date_asc
value 'DUE_DATE_DESC', 'Milestone due date by descending order.', value: :due_date_desc
value 'EXPIRED_LAST_DUE_DATE_ASC', 'Group milestones in this order: non-expired milestones with due dates, non-expired milestones without due dates and expired milestones then sort by due date in ascending order.', value: :expired_last_due_date_asc
value 'EXPIRED_LAST_DUE_DATE_DESC', 'Group milestones in this order: non-expired milestones with due dates, non-expired milestones without due dates and expired milestones then sort by due date in descending order.', value: :expired_last_due_date_desc
value 'EXPIRED_LAST_DUE_DATE_ASC',
'Group milestones in this order: non-expired milestones with due dates, non-expired milestones ' \
'without due dates and expired milestones then sort by due date in ascending order.',
value: :expired_last_due_date_asc
value 'EXPIRED_LAST_DUE_DATE_DESC',
'Group milestones in this order: non-expired milestones with due dates, non-expired milestones ' \
'without due dates and expired milestones then sort by due date in descending order.',
value: :expired_last_due_date_desc
end
end
......@@ -27,10 +27,12 @@ class MilestoneType < BaseObject
description: 'State of the milestone.'
field :expired, GraphQL::Types::Boolean, null: false,
description: 'Expired state of the milestone (a milestone is expired when the due date is past the current date). Defaults to `false` when due date has not been set.'
description: 'Expired state of the milestone (a milestone is expired when the due date is past the current ' \
'date). Defaults to `false` when due date has not been set.'
field :upcoming, GraphQL::Types::Boolean, null: false,
description: 'Upcoming state of the milestone (a milestone is upcoming when the start date is in the future). Defaults to `false` when start date has not been set.'
description: 'Upcoming state of the milestone (a milestone is upcoming when the start date is in the future). ' \
'Defaults to `false` when start date has not been set.'
field :web_path, GraphQL::Types::String, null: false, method: :milestone_path,
description: 'Web path of the milestone.'
......
......@@ -10,13 +10,15 @@ class Namespace::PackageSettingsType < BaseObject
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.'
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.'
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.'
......@@ -28,7 +30,8 @@ class Namespace::PackageSettingsType < BaseObject
description: 'Indicates whether npm package forwarding is allowed for this namespace.'
field :nuget_duplicate_exception_regex, Types::UntrustedRegexp,
null: true,
description: 'When nuget_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect. '
description: 'When nuget_duplicates_allowed is false, you can publish duplicate packages with names that ' \
'match this regex. Otherwise, this setting has no effect. '
field :nuget_duplicates_allowed, GraphQL::Types::Boolean,
null: false,
description: 'Indicates whether duplicate NuGet packages are allowed for this namespace.'
......@@ -37,7 +40,8 @@ class Namespace::PackageSettingsType < BaseObject
description: 'Indicates whether PyPI package forwarding is allowed for this namespace.'
field :terraform_module_duplicate_exception_regex, Types::UntrustedRegexp,
null: true,
description: 'When terraform_module_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.'
description: 'When terraform_module_duplicates_allowed is false, you can publish duplicate packages with ' \
'names that match this regex. Otherwise, this setting has no effect.'
field :terraform_module_duplicates_allowed, GraphQL::Types::Boolean,
null: false,
description: 'Indicates whether duplicate Terraform packages are allowed for this namespace.'
......
......@@ -5,8 +5,10 @@ module Notes
module NoteableInterface
include Types::BaseInterface
field :notes, resolver: Resolvers::Noteable::NotesResolver, null: false, description: "All notes on this noteable."
field :discussions, Types::Notes::DiscussionType.connection_type, null: false, description: "All discussions on this noteable."
field :notes, resolver: Resolvers::Noteable::NotesResolver, null: false,
description: "All notes on this noteable."
field :discussions, Types::Notes::DiscussionType.connection_type, null: false,
description: "All discussions on this noteable."
field :commenters, Types::UserType.connection_type, null: false, description: "All commenters on this noteable."
def self.resolve_type(object, context)
......
......@@ -9,7 +9,8 @@ class MetadatumType < BaseObject
authorize :read_package
field :composer_json, Types::Packages::Composer::JsonType, null: false, description: 'Data of the Composer JSON file.'
field :composer_json, Types::Packages::Composer::JsonType, null: false,
description: 'Data of the Composer JSON file.'
field :target_sha, GraphQL::Types::String, null: false, description: 'Target SHA of the package.'
end
end
......
......@@ -11,11 +11,16 @@ class FileMetadatumType < BaseObject
authorize :read_package
field :conan_file_type, ::Types::Packages::Conan::MetadatumFileTypeEnum, null: false, description: 'Type of the Conan file.'
field :conan_package_reference, GraphQL::Types::String, null: true, description: 'Reference of the Conan package.'
field :id, ::Types::GlobalIDType[::Packages::Conan::FileMetadatum], null: false, description: 'ID of the metadatum.'
field :package_revision, GraphQL::Types::String, null: true, description: 'Revision of the package.', method: :package_revision_value
field :recipe_revision, GraphQL::Types::String, null: false, description: 'Revision of the Conan recipe.', method: :recipe_revision_value
field :conan_file_type, ::Types::Packages::Conan::MetadatumFileTypeEnum, null: false,
description: 'Type of the Conan file.'
field :conan_package_reference, GraphQL::Types::String, null: true,
description: 'Reference of the Conan package.'
field :id, ::Types::GlobalIDType[::Packages::Conan::FileMetadatum], null: false,
description: 'ID of the metadatum.'
field :package_revision, GraphQL::Types::String, null: true, description: 'Revision of the package.',
method: :package_revision_value
field :recipe_revision, GraphQL::Types::String, null: false, description: 'Revision of the Conan recipe.',
method: :recipe_revision_value
end
end
end
......
......@@ -9,10 +9,15 @@ class DependencyType < BaseObject
description 'Represents a Helm dependency'
# Need to be synced with app/validators/json_schemas/helm_metadata.json#dependencies
field :alias, GraphQL::Types::String, null: true, description: 'Alias of the dependency.', resolver_method: :resolve_alias
field :alias,
GraphQL::Types::String,
null: true,
description: 'Alias of the dependency.',
resolver_method: :resolve_alias
field :condition, GraphQL::Types::String, null: true, description: 'Condition of the dependency.'
field :enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates the dependency is enabled.'
field :import_values, [GraphQL::Types::JSON], null: true, description: 'Import-values of the dependency.', hash_key: :'import-values'
field :import_values, [GraphQL::Types::JSON], null: true, description: 'Import-values of the dependency.',
hash_key: :'import-values'
field :name, GraphQL::Types::String, null: true, description: 'Name of the dependency.'
field :repository, GraphQL::Types::String, null: true, description: 'Repository of the dependency.'
field :tags, [GraphQL::Types::String], null: true, description: 'Tags of the dependency.'
......
......@@ -10,17 +10,31 @@ class MetadataType < BaseObject
# Need to be synced with app/validators/json_schemas/helm_metadata.json
field :annotations, GraphQL::Types::JSON, null: true, description: 'Annotations for the chart.' # rubocop:disable Graphql/JSONType
field :api_version, GraphQL::Types::String, null: false, description: 'API version of the chart.', hash_key: :apiVersion
field :app_version, GraphQL::Types::String, null: true, description: 'App version of the chart.', hash_key: :appVersion
field :api_version,
GraphQL::Types::String,
null: false,
description: 'API version of the chart.',
hash_key: :apiVersion
field :app_version,
GraphQL::Types::String,
null: true,
description: 'App version of the chart.',
hash_key: :appVersion
field :condition, GraphQL::Types::String, null: true, description: 'Condition for the chart.'
field :dependencies, [Types::Packages::Helm::DependencyType], null: true, description: 'Dependencies of the chart.'
field :dependencies, [Types::Packages::Helm::DependencyType], null: true,
description: 'Dependencies of the chart.'
field :deprecated, GraphQL::Types::Boolean, null: true, description: 'Indicates if the chart is deprecated.'
field :description, GraphQL::Types::String, null: true, description: 'Description of the chart.'
field :home, GraphQL::Types::String, null: true, description: 'URL of the home page.'
field :icon, GraphQL::Types::String, null: true, description: 'URL to an SVG or PNG image for the chart.'
field :keywords, [GraphQL::Types::String], null: true, description: 'Keywords for the chart.'
field :kube_version, GraphQL::Types::String, null: true, description: 'Kubernetes versions for the chart.', hash_key: :kubeVersion
field :maintainers, [Types::Packages::Helm::MaintainerType], null: true, description: 'Maintainers of the chart.'
field :kube_version,
GraphQL::Types::String,
null: true,
description: 'Kubernetes versions for the chart.',
hash_key: :kubeVersion
field :maintainers, [Types::Packages::Helm::MaintainerType], null: true,
description: 'Maintainers of the chart.'
field :name, GraphQL::Types::String, null: false, description: 'Name of the chart.'
field :sources, [GraphQL::Types::String], null: true, description: 'URLs of the source code for the chart.'
field :tags, GraphQL::Types::String, null: true, description: 'Tags for the chart.'
......
......@@ -9,8 +9,10 @@ class DependencyLinkMetadatumType < BaseObject
authorize :read_package
field :id, ::Types::GlobalIDType[::Packages::Nuget::DependencyLinkMetadatum], null: false, description: 'ID of the metadatum.'
field :target_framework, GraphQL::Types::String, null: false, description: 'Target framework of the dependency link package.'
field :id, ::Types::GlobalIDType[::Packages::Nuget::DependencyLinkMetadatum], null: false,
description: 'ID of the metadatum.'
field :target_framework, GraphQL::Types::String, null: false,
description: 'Target framework of the dependency link package.'
end
end
end
......
......@@ -9,7 +9,8 @@ class PackageDependencyLinkType < BaseObject
field :dependency, Types::Packages::PackageDependencyType, null: true, description: 'Dependency.'
field :dependency_type, Types::Packages::PackageDependencyTypeEnum, null: false, description: 'Dependency type.'
field :id, ::Types::GlobalIDType[::Packages::DependencyLink], null: false, description: 'ID of the dependency link.'
field :id, ::Types::GlobalIDType[::Packages::DependencyLink], null: false,
description: 'ID of the dependency link.'
field :metadata, Types::Packages::DependencyLinkMetadataType, null: true, description: 'Dependency link metadata.'
# NOTE: This method must be kept in sync with the union
......
......@@ -13,11 +13,17 @@ class PackageDetailsType < PackageType
field :versions, ::Types::Packages::PackageBaseType.connection_type, null: true,
description: 'Other versions of the package.'
field :package_files, Types::Packages::PackageFileType.connection_type, null: true, method: :installable_package_files, description: 'Package files.'
field :package_files,
Types::Packages::PackageFileType.connection_type,
null: true,
method: :installable_package_files,
description: 'Package files.'
field :dependency_links, Types::Packages::PackageDependencyLinkType.connection_type, null: true, description: 'Dependency link.'
field :dependency_links, Types::Packages::PackageDependencyLinkType.connection_type, null: true,
description: 'Dependency link.'
field :composer_config_repository_url, GraphQL::Types::String, null: true, description: 'Url of the Composer setup endpoint.'
field :composer_config_repository_url, GraphQL::Types::String, null: true,
description: 'Url of the Composer setup endpoint.'
field :composer_url, GraphQL::Types::String, null: true, description: 'Url of the Composer endpoint.'
field :conan_url, GraphQL::Types::String, null: true, description: 'Url of the Conan project endpoint.'
field :maven_url, GraphQL::Types::String, null: true, description: 'Url of the Maven project endpoint.'
......@@ -26,9 +32,11 @@ class PackageDetailsType < PackageType
field :pypi_setup_url, GraphQL::Types::String, null: true, description: 'Url of the PyPi project setup endpoint.'
field :pypi_url, GraphQL::Types::String, null: true, description: 'Url of the PyPi project endpoint.'
field :last_downloaded_at, Types::TimeType, null: true, description: 'Last time that a file of this package was downloaded.'
field :last_downloaded_at, Types::TimeType, null: true,
description: 'Last time that a file of this package was downloaded.'
field :public_package, GraphQL::Types::Boolean, null: true, description: 'Indicates if there is public access to the package.'
field :public_package, GraphQL::Types::Boolean, null: true,
description: 'Indicates if there is public access to the package.'
def composer_config_repository_url
composer_config_repository_name(object.project.group&.id)
......
......@@ -11,7 +11,9 @@ class PackageTypeEnum < BaseEnum
::Packages::Package.package_types.keys.each do |package_type|
type_name = PACKAGE_TYPE_NAMES.fetch(package_type.to_sym, package_type.capitalize)
value package_type.to_s.upcase, description: "Packages from the #{type_name} package manager", value: package_type.to_s
value package_type.to_s.upcase,
description: "Packages from the #{type_name} package manager",
value: package_type.to_s
end
end
end
......
......@@ -18,7 +18,8 @@ class MetadatumType < BaseObject
field :id, ::Types::GlobalIDType[::Packages::Pypi::Metadatum], null: false, description: 'ID of the metadatum.'
field :keywords, GraphQL::Types::String, null: true, description: 'List of keywords, separated by commas.'
field :metadata_version, GraphQL::Types::String, null: true, description: 'Metadata version.'
field :required_python, GraphQL::Types::String, null: true, description: 'Required Python version of the Pypi package.'
field :required_python, GraphQL::Types::String, null: true,
description: 'Required Python version of the Pypi package.'
field :summary, GraphQL::Types::String, null: true, description: 'One-line summary of the description.'
end
end
......
......@@ -190,7 +190,8 @@ class ProjectType < BaseObject
field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::Types::Boolean,
null: true,
description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.'
description: 'Indicates if merge requests of the project can only be merged ' \
'when all the discussions are resolved.'
field :only_allow_merge_if_pipeline_succeeds, GraphQL::Types::Boolean,
null: true,
......@@ -658,7 +659,8 @@ class ProjectType < BaseObject
field :data_transfer, Types::DataTransfer::ProjectDataTransferType,
null: true, # disallow null once data_transfer_monitoring feature flag is rolled-out! https://gitlab.com/gitlab-org/gitlab/-/issues/391682
resolver: Resolvers::DataTransfer::ProjectDataTransferResolver,
description: 'Data transfer data point for a specific period. This is mocked data under a development feature flag.'
description: 'Data transfer data point for a specific period. ' \
'This is mocked data under a development feature flag.'
field :visible_forks, Types::ProjectType.connection_type,
null: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment