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
e3939b1b
Commit
e3939b1b
authored
Dec 04, 2021
by
Kev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GraphQL/FieldDefinitions offense (Part 3/4)
Changelog: other
parent
5e2a6116
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
34 deletions
+34
-34
.rubocop_todo/graphql/field_definitions.yml
.rubocop_todo/graphql/field_definitions.yml
+0
-3
app/graphql/types/project_type.rb
app/graphql/types/project_type.rb
+26
-25
app/graphql/types/projects/topic_type.rb
app/graphql/types/projects/topic_type.rb
+2
-1
app/graphql/types/release_type.rb
app/graphql/types/release_type.rb
+6
-5
No files found.
.rubocop_todo/graphql/field_definitions.yml
View file @
e3939b1b
...
...
@@ -5,9 +5,6 @@ GraphQL/FieldDefinitions:
-
app/graphql/types/group_type.rb
-
app/graphql/types/issue_type.rb
-
app/graphql/types/label_type.rb
-
app/graphql/types/project_type.rb
-
app/graphql/types/projects/topic_type.rb
-
app/graphql/types/release_type.rb
-
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
...
...
app/graphql/types/project_type.rb
View file @
e3939b1b
...
...
@@ -27,7 +27,6 @@ module Types
field
:description
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Short description of the project.'
markdown_field
:description_html
,
null:
true
field
:tag_list
,
GraphQL
::
Types
::
String
,
null:
true
,
deprecated:
{
reason:
'Use `topics`'
,
milestone:
'13.12'
},
...
...
@@ -75,21 +74,6 @@ module Types
field
:avatar_url
,
GraphQL
::
Types
::
String
,
null:
true
,
calls_gitaly:
true
,
description:
'URL to avatar image file of the project.'
{
issues:
"Issues are"
,
merge_requests:
"Merge Requests are"
,
wiki:
'Wikis are'
,
snippets:
'Snippets are'
,
container_registry:
'Container Registry is'
}.
each
do
|
feature
,
name_string
|
field
"
#{
feature
}
_enabled"
,
GraphQL
::
Types
::
Boolean
,
null:
true
,
description:
"Indicates if
#{
name_string
}
enabled for the current user"
define_method
"
#{
feature
}
_enabled"
do
object
.
feature_available?
(
feature
,
context
[
:current_user
])
end
end
field
:jobs_enabled
,
GraphQL
::
Types
::
Boolean
,
null:
true
,
description:
'Indicates if CI/CD pipeline jobs are enabled for the current user.'
...
...
@@ -391,15 +375,6 @@ module Types
null:
true
,
description:
'Template used to create squash commit message in merge requests.'
def
label
(
title
:)
BatchLoader
::
GraphQL
.
for
(
title
).
batch
(
key:
project
)
do
|
titles
,
loader
,
args
|
LabelsFinder
.
new
(
current_user
,
project:
args
[
:key
],
title:
titles
)
.
execute
.
each
{
|
label
|
loader
.
call
(
label
.
title
,
label
)
}
end
end
field
:labels
,
Types
::
LabelType
.
connection_type
,
null:
true
,
...
...
@@ -411,6 +386,32 @@ module Types
description:
'Work item types available to the project.'
,
feature_flag: :work_items
def
label
(
title
:)
BatchLoader
::
GraphQL
.
for
(
title
).
batch
(
key:
project
)
do
|
titles
,
loader
,
args
|
LabelsFinder
.
new
(
current_user
,
project:
args
[
:key
],
title:
titles
)
.
execute
.
each
{
|
label
|
loader
.
call
(
label
.
title
,
label
)
}
end
end
{
issues:
"Issues are"
,
merge_requests:
"Merge Requests are"
,
wiki:
'Wikis are'
,
snippets:
'Snippets are'
,
container_registry:
'Container Registry is'
}.
each
do
|
feature
,
name_string
|
field
"
#{
feature
}
_enabled"
,
GraphQL
::
Types
::
Boolean
,
null:
true
,
description:
"Indicates if
#{
name_string
}
enabled for the current user"
define_method
"
#{
feature
}
_enabled"
do
object
.
feature_available?
(
feature
,
context
[
:current_user
])
end
end
markdown_field
:description_html
,
null:
true
def
avatar_url
object
.
avatar_url
(
only_path:
false
)
end
...
...
app/graphql/types/projects/topic_type.rb
View file @
e3939b1b
...
...
@@ -14,11 +14,12 @@ module Types
field
:description
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Description of the topic.'
markdown_field
:description_html
,
null:
true
field
:avatar_url
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'URL to avatar image file of the topic.'
markdown_field
:description_html
,
null:
true
def
avatar_url
object
.
avatar_url
(
only_path:
false
)
end
...
...
app/graphql/types/release_type.rb
View file @
e3939b1b
...
...
@@ -20,7 +20,6 @@ module Types
authorize: :download_code
field
:description
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Description (also known as "release notes") of the release.'
markdown_field
:description_html
,
null:
true
field
:name
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Name of the release.'
field
:created_at
,
Types
::
TimeType
,
null:
true
,
...
...
@@ -42,14 +41,16 @@ module Types
field
:author
,
Types
::
UserType
,
null:
true
,
description:
'User that created the release.'
def
author
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
User
,
release
.
author_id
).
find
end
field
:commit
,
Types
::
CommitType
,
null:
true
,
complexity:
10
,
calls_gitaly:
true
,
description:
'Commit associated with the release.'
markdown_field
:description_html
,
null:
true
def
author
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
User
,
release
.
author_id
).
find
end
def
commit
return
if
release
.
sha
.
nil?
...
...
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