Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
95ac4322
Commit
95ac4322
authored
Mar 15, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rubocop: Fix todo-ed violations
This fixes a number of TODO-ed Rubocop violations.
parent
b49f92b4
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
156 additions
and
87 deletions
+156
-87
app/graphql/mutations/base_mutation.rb
app/graphql/mutations/base_mutation.rb
+3
-5
app/graphql/resolvers/ci/config_resolver.rb
app/graphql/resolvers/ci/config_resolver.rb
+5
-1
app/graphql/resolvers/ci/runner_setup_resolver.rb
app/graphql/resolvers/ci/runner_setup_resolver.rb
+23
-13
app/graphql/resolvers/echo_resolver.rb
app/graphql/resolvers/echo_resolver.rb
+4
-2
app/graphql/resolvers/group_milestones_resolver.rb
app/graphql/resolvers/group_milestones_resolver.rb
+0
-1
app/graphql/resolvers/user_starred_projects_resolver.rb
app/graphql/resolvers/user_starred_projects_resolver.rb
+2
-2
app/graphql/types/boards/board_issue_input_type.rb
app/graphql/types/boards/board_issue_input_type.rb
+4
-1
app/graphql/types/group_type.rb
app/graphql/types/group_type.rb
+46
-17
app/graphql/types/jira_users_mapping_input_type.rb
app/graphql/types/jira_users_mapping_input_type.rb
+6
-6
app/graphql/types/query_type.rb
app/graphql/types/query_type.rb
+8
-15
app/graphql/types/user_type.rb
app/graphql/types/user_type.rb
+46
-20
ee/app/graphql/ee/types/query_type.rb
ee/app/graphql/ee/types/query_type.rb
+9
-4
No files found.
app/graphql/mutations/base_mutation.rb
View file @
95ac4322
...
...
@@ -29,12 +29,10 @@ module Mutations
end
def
ready?
(
**
args
)
if
Gitlab
::
Database
.
read_only?
raise_resource_not_available_error!
ERROR_MESSAGE
else
raise_resource_not_available_error!
ERROR_MESSAGE
if
Gitlab
::
Database
.
read_only?
true
end
end
def
load_application_object
(
argument
,
lookup_as_type
,
id
,
context
)
::
Gitlab
::
Graphql
::
Lazy
.
new
{
super
}.
catch
(
::
GraphQL
::
UnauthorizedError
)
do
|
e
|
...
...
app/graphql/resolvers/ci/config_resolver.rb
View file @
95ac4322
...
...
@@ -7,6 +7,10 @@ module Resolvers
include
ResolvesProject
type
Types
::
Ci
::
Config
::
ConfigType
,
null:
true
description
<<~
MD
Linted and processed contents of a CI config.
Should not be requested more than once per request.
MD
authorize
:read_pipeline
...
...
@@ -55,7 +59,7 @@ module Resolvers
name:
job
[
:name
],
stage:
job
[
:stage
],
group_name:
CommitStatus
.
new
(
name:
job
[
:name
]).
group_name
,
needs:
job
.
dig
(
:needs
)
||
[],
needs:
job
[
:needs
]
||
[],
allow_failure:
job
[
:allow_failure
],
before_script:
job
[
:before_script
],
script:
job
[
:script
],
...
...
app/graphql/resolvers/ci/runner_setup_resolver.rb
View file @
95ac4322
...
...
@@ -3,22 +3,28 @@
module
Resolvers
module
Ci
class
RunnerSetupResolver
<
BaseResolver
ACCESS_DENIED
=
'User is not authorized to register a runner for the specified resource!'
type
Types
::
Ci
::
RunnerSetupType
,
null:
true
description
'Runner setup instructions.'
argument
:platform
,
GraphQL
::
STRING_TYPE
,
argument
:platform
,
type:
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
'Platform to generate the instructions for.'
argument
:architecture
,
GraphQL
::
STRING_TYPE
,
argument
:architecture
,
type:
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
'Architecture to generate the instructions for.'
argument
:project_id
,
::
Types
::
GlobalIDType
[
::
Project
],
argument
:project_id
,
type:
::
Types
::
GlobalIDType
[
::
Project
],
required:
false
,
description:
'Project to register the runner for.'
argument
:group_id
,
::
Types
::
GlobalIDType
[
::
Group
],
argument
:group_id
,
type:
::
Types
::
GlobalIDType
[
::
Group
],
required:
false
,
description:
'Group to register the runner for.'
...
...
@@ -35,11 +41,15 @@ module Resolvers
register_instructions:
instructions
.
register_command
}
ensure
raise
Gitlab
::
Graphql
::
Errors
::
ResourceNotAvailable
,
'User is not authorized to register a runner for the specified resource!'
if
instructions
.
errors
.
include?
(
'Gitlab::Access::AccessDeniedError'
)
raise
Gitlab
::
Graphql
::
Errors
::
ResourceNotAvailable
,
ACCESS_DENIED
if
access_denied?
(
instructions
)
end
private
def
access_denied?
(
instructions
)
instructions
.
errors
.
include?
(
'Gitlab::Access::AccessDeniedError'
)
end
def
other_install_instructions
(
platform
)
Gitlab
::
Ci
::
RunnerInstructions
::
OTHER_ENVIRONMENTS
[
platform
.
to_sym
][
:installation_instructions_url
]
end
...
...
app/graphql/resolvers/echo_resolver.rb
View file @
95ac4322
...
...
@@ -5,7 +5,9 @@ module Resolvers
type
::
GraphQL
::
STRING_TYPE
,
null:
false
description
'Testing endpoint to validate the API with'
argument
:text
,
GraphQL
::
STRING_TYPE
,
required:
true
,
argument
:text
,
type:
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
'Text to echo back.'
def
resolve
(
text
:)
...
...
app/graphql/resolvers/group_milestones_resolver.rb
View file @
95ac4322
# frozen_string_literal: true
# rubocop:disable Graphql/ResolverType (inherited from MilestonesResolver)
module
Resolvers
class
GroupMilestonesResolver
<
MilestonesResolver
...
...
app/graphql/resolvers/user_starred_projects_resolver.rb
View file @
95ac4322
app/graphql/types/boards/board_issue_input_type.rb
View file @
95ac4322
...
...
@@ -10,7 +10,10 @@ module Types
argument
:not
,
NegatedBoardIssueInputType
,
required:
false
,
description:
'List of negated params. Warning: this argument is experimental and a subject to change in future.'
description:
<<~
MD
List of negated arguments.
Warning: this argument is experimental and a subject to change in future.
MD
argument
:search
,
GraphQL
::
STRING_TYPE
,
required:
false
,
...
...
app/graphql/types/group_type.rb
View file @
95ac4322
...
...
@@ -8,39 +8,65 @@ module Types
expose_permissions
Types
::
PermissionTypes
::
Group
field
:web_url
,
GraphQL
::
STRING_TYPE
,
null:
false
,
field
:web_url
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web URL of the group.'
field
:avatar_url
,
GraphQL
::
STRING_TYPE
,
null:
true
,
field
:avatar_url
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Avatar URL of the group.'
field
:custom_emoji
,
Types
::
CustomEmojiType
.
connection_type
,
null:
true
,
field
:custom_emoji
,
type:
Types
::
CustomEmojiType
.
connection_type
,
null:
true
,
description:
'Custom emoji within this namespace.'
,
feature_flag: :custom_emoji
field
:share_with_group_lock
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
field
:share_with_group_lock
,
type:
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Indicates if sharing a project with another group within this group is prevented.'
field
:project_creation_level
,
GraphQL
::
STRING_TYPE
,
null:
true
,
method: :project_creation_level_str
,
field
:project_creation_level
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
method: :project_creation_level_str
,
description:
'The permission level required to create projects in the group.'
field
:subgroup_creation_level
,
GraphQL
::
STRING_TYPE
,
null:
true
,
method: :subgroup_creation_level_str
,
field
:subgroup_creation_level
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
method: :subgroup_creation_level_str
,
description:
'The permission level required to create subgroups within the group.'
field
:require_two_factor_authentication
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
field
:require_two_factor_authentication
,
type:
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Indicates if all users in this group are required to set up two-factor authentication.'
field
:two_factor_grace_period
,
GraphQL
::
INT_TYPE
,
null:
true
,
field
:two_factor_grace_period
,
type:
GraphQL
::
INT_TYPE
,
null:
true
,
description:
'Time before two-factor authentication is enforced.'
field
:auto_devops_enabled
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
field
:auto_devops_enabled
,
type:
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Indicates whether Auto DevOps is enabled for all projects within this group.'
field
:emails_disabled
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
field
:emails_disabled
,
type:
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Indicates if a group has email notifications disabled.'
field
:mentions_disabled
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
field
:mentions_disabled
,
type:
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
description:
'Indicates if a group is disabled from getting mentioned.'
field
:parent
,
GroupType
,
null:
true
,
field
:parent
,
type:
GroupType
,
null:
true
,
description:
'Parent group.'
field
:issues
,
...
...
@@ -55,7 +81,7 @@ module Types
description:
'Merge requests for projects in this group.'
,
resolver:
Resolvers
::
GroupMergeRequestsResolver
field
:milestones
,
Types
::
MilestoneType
.
connection_type
,
null:
true
,
field
:milestones
,
description:
'Milestones of the group.'
,
resolver:
Resolvers
::
GroupMilestonesResolver
...
...
@@ -76,7 +102,8 @@ module Types
Types
::
LabelType
,
null:
true
,
description:
'A label available on this group.'
do
argument
:title
,
GraphQL
::
STRING_TYPE
,
argument
:title
,
type:
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
'Title of the label.'
end
...
...
@@ -92,7 +119,9 @@ module Types
resolver:
Resolvers
::
ContainerRepositoriesResolver
,
authorize: :read_container_image
field
:container_repositories_count
,
GraphQL
::
INT_TYPE
,
null:
false
,
field
:container_repositories_count
,
type:
GraphQL
::
INT_TYPE
,
null:
false
,
description:
'Number of container repositories in the group.'
field
:packages
,
...
...
app/graphql/types/jira_users_mapping_input_type.rb
View file @
95ac4322
...
...
@@ -11,6 +11,6 @@ module Types
argument
:gitlab_id
,
GraphQL
::
INT_TYPE
,
required:
false
,
description:
'Id
of the GitLab user.'
description:
'ID
of the GitLab user.'
end
end
app/graphql/types/query_type.rb
View file @
95ac4322
...
...
@@ -55,7 +55,10 @@ module Types
field
:container_repository
,
Types
::
ContainerRepositoryDetailsType
,
null:
true
,
description:
'Find a container repository.'
do
argument
:id
,
::
Types
::
GlobalIDType
[
::
ContainerRepository
],
required:
true
,
description:
'The global ID of the container repository.'
argument
:id
,
type:
::
Types
::
GlobalIDType
[
::
ContainerRepository
],
required:
true
,
description:
'The global ID of the container repository.'
end
field
:package
,
...
...
@@ -72,9 +75,7 @@ module Types
description:
'Find users.'
,
resolver:
Resolvers
::
UsersResolver
field
:echo
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Text to echo back.'
,
resolver:
Resolvers
::
EchoResolver
field
:echo
,
resolver:
Resolvers
::
EchoResolver
field
:issue
,
Types
::
IssueType
,
null:
true
,
...
...
@@ -102,18 +103,10 @@ module Types
null:
true
,
description:
'CI related settings that apply to the entire instance.'
field
:runner_platforms
,
Types
::
Ci
::
RunnerPlatformType
.
connection_type
,
null:
true
,
description:
'Supported runner platforms.'
,
resolver:
Resolvers
::
Ci
::
RunnerPlatformsResolver
field
:runner_platforms
,
resolver:
Resolvers
::
Ci
::
RunnerPlatformsResolver
field
:runner_setup
,
resolver:
Resolvers
::
Ci
::
RunnerSetupResolver
field
:runner_setup
,
Types
::
Ci
::
RunnerSetupType
,
null:
true
,
description:
'Get runner setup instructions.'
,
resolver:
Resolvers
::
Ci
::
RunnerSetupResolver
field
:ci_config
,
Types
::
Ci
::
Config
::
ConfigType
,
null:
true
,
description:
'Get linted and processed contents of a CI config. Should not be requested more than once per request.'
,
resolver:
Resolvers
::
Ci
::
ConfigResolver
,
complexity:
126
# AUTHENTICATED_COMPLEXITY / 2 + 1
field
:ci_config
,
resolver:
Resolvers
::
Ci
::
ConfigResolver
,
complexity:
126
# AUTHENTICATED_COMPLEXITY / 2 + 1
def
design_management
DesignManagementObject
.
new
(
nil
)
...
...
app/graphql/types/user_type.rb
View file @
95ac4322
...
...
@@ -11,44 +11,72 @@ module Types
expose_permissions
Types
::
PermissionTypes
::
User
field
:id
,
GraphQL
::
ID_TYPE
,
null:
false
,
field
:id
,
type:
GraphQL
::
ID_TYPE
,
null:
false
,
description:
'ID of the user.'
field
:bot
,
GraphQL
::
BOOLEAN_TYPE
,
null:
false
,
field
:bot
,
type:
GraphQL
::
BOOLEAN_TYPE
,
null:
false
,
description:
'Indicates if the user is a bot.'
,
method: :bot?
field
:username
,
GraphQL
::
STRING_TYPE
,
null:
false
,
field
:username
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Username of the user. Unique within this instance of GitLab.'
field
:name
,
GraphQL
::
STRING_TYPE
,
null:
false
,
field
:name
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Human-readable name of the user.'
field
:state
,
Types
::
UserStateEnum
,
null:
false
,
field
:state
,
type:
Types
::
UserStateEnum
,
null:
false
,
description:
'State of the user.'
field
:email
,
GraphQL
::
STRING_TYPE
,
null:
true
,
field
:email
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'User email.'
,
method: :public_email
,
deprecated:
{
reason: :renamed
,
replacement:
'User.publicEmail'
,
milestone:
'13.7'
}
field
:public_email
,
GraphQL
::
STRING_TYPE
,
null:
true
,
field
:public_email
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
"User's public email."
field
:avatar_url
,
GraphQL
::
STRING_TYPE
,
null:
true
,
field
:avatar_url
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
"URL of the user's avatar."
field
:web_url
,
GraphQL
::
STRING_TYPE
,
null:
false
,
field
:web_url
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web URL of the user.'
field
:web_path
,
GraphQL
::
STRING_TYPE
,
null:
false
,
field
:web_path
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web path of the user.'
field
:todos
,
Types
::
TodoType
.
connection_type
,
null:
false
,
field
:todos
,
resolver:
Resolvers
::
TodoResolver
,
description:
'To-do items of the user.'
field
:group_memberships
,
Types
::
GroupMemberType
.
connection_type
,
null:
true
,
field
:group_memberships
,
type:
Types
::
GroupMemberType
.
connection_type
,
null:
true
,
description:
'Group memberships of the user.'
field
:group_count
,
GraphQL
::
INT_TYPE
,
null:
true
,
field
:group_count
,
resolver:
Resolvers
::
Users
::
GroupCountResolver
,
description:
'Group count for the user.'
,
feature_flag: :user_group_counts
field
:status
,
Types
::
UserStatusType
,
null:
true
,
field
:status
,
type:
Types
::
UserStatusType
,
null:
true
,
description:
'User status.'
field
:location
,
::
GraphQL
::
STRING_TYPE
,
null:
true
,
field
:location
,
type:
::
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'The location of the user.'
field
:project_memberships
,
Types
::
ProjectMemberType
.
connection_type
,
null:
true
,
field
:project_memberships
,
type:
Types
::
ProjectMemberType
.
connection_type
,
null:
true
,
description:
'Project memberships of the user.'
field
:starred_projects
,
Types
::
ProjectType
.
connection_type
,
null:
true
,
field
:starred_projects
,
description:
'Projects starred by the user.'
,
resolver:
Resolvers
::
UserStarredProjectsResolver
...
...
@@ -64,8 +92,6 @@ module Types
description:
'Merge Requests assigned to the user for review.'
field
:snippets
,
Types
::
SnippetType
.
connection_type
,
null:
true
,
description:
'Snippets authored by the user.'
,
resolver:
Resolvers
::
Users
::
SnippetsResolver
field
:callouts
,
...
...
ee/app/graphql/ee/types/query_type.rb
View file @
95ac4322
...
...
@@ -32,15 +32,20 @@ module EE
field
:vulnerabilities_count_by_day
,
::
Types
::
VulnerabilitiesCountByDayType
.
connection_type
,
null:
true
,
description:
"Number of vulnerabilities per day for the projects on the current user's instance security dashboard."
,
resolver:
::
Resolvers
::
VulnerabilitiesCountPerDayResolver
resolver:
::
Resolvers
::
VulnerabilitiesCountPerDayResolver
,
description:
<<~
DESC
Number of vulnerabilities per day for the projects on the current user's instance security dashboard.
DESC
field
:vulnerabilities_count_by_day_and_severity
,
::
Types
::
VulnerabilitiesCountByDayAndSeverityType
.
connection_type
,
null:
true
,
description:
"Number of vulnerabilities per severity level, per day, for the projects on the current user's instance security dashboard."
,
resolver:
::
Resolvers
::
VulnerabilitiesHistoryResolver
,
deprecated:
{
reason: :discouraged
,
replacement:
'Query.vulnerabilitiesCountByDay'
,
milestone:
'13.3'
}
deprecated:
{
reason: :discouraged
,
replacement:
'Query.vulnerabilitiesCountByDay'
,
milestone:
'13.3'
},
description:
<<~
DESC
Number of vulnerabilities per severity level, per day, for the projects on the
current user's instance security dashboard.
DESC
field
:geo_node
,
::
Types
::
Geo
::
GeoNodeType
,
null:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment