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
62a0a203
Commit
62a0a203
authored
Dec 04, 2021
by
Kev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GraphQL/FieldDefinitions offense (Part 1/4)
Changelog: other
parent
26180cf7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
19 deletions
+25
-19
.rubocop_todo/graphql/field_definitions.yml
.rubocop_todo/graphql/field_definitions.yml
+0
-4
app/graphql/types/commit_type.rb
app/graphql/types/commit_type.rb
+11
-3
app/graphql/types/group_type.rb
app/graphql/types/group_type.rb
+9
-9
app/graphql/types/issue_type.rb
app/graphql/types/issue_type.rb
+3
-2
app/graphql/types/label_type.rb
app/graphql/types/label_type.rb
+2
-1
No files found.
.rubocop_todo/graphql/field_definitions.yml
View file @
62a0a203
---
GraphQL/FieldDefinitions
:
Exclude
:
-
app/graphql/types/commit_type.rb
-
app/graphql/types/group_type.rb
-
app/graphql/types/issue_type.rb
-
app/graphql/types/label_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/commit_type.rb
View file @
62a0a203
...
...
@@ -10,33 +10,37 @@ module Types
field
:id
,
type:
GraphQL
::
Types
::
ID
,
null:
false
,
description:
'ID (global ID) of the commit.'
field
:sha
,
type:
GraphQL
::
Types
::
String
,
null:
false
,
description:
'SHA1 ID of the commit.'
field
:short_id
,
type:
GraphQL
::
Types
::
String
,
null:
false
,
description:
'Short SHA1 ID of the commit.'
field
:title
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
calls_gitaly:
true
,
description:
'Title of the commit message.'
markdown_field
:title_html
,
null:
true
field
:full_title
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
calls_gitaly:
true
,
description:
'Full title of the commit message.'
markdown_field
:full_title_html
,
null:
true
field
:description
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Description of the commit message.'
markdown_field
:description_html
,
null:
true
field
:message
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Raw commit message.'
field
:authored_date
,
type:
Types
::
TimeType
,
null:
true
,
description:
'Timestamp of when the commit was authored.'
field
:web_url
,
type:
GraphQL
::
Types
::
String
,
null:
false
,
description:
'Web URL of the commit.'
field
:web_path
,
type:
GraphQL
::
Types
::
String
,
null:
false
,
description:
'Web path of the commit.'
field
:signature_html
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
calls_gitaly:
true
,
description:
'Rendered HTML of the commit signature.'
field
:author_name
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Commit authors name.'
field
:author_email
,
type:
GraphQL
::
Types
::
String
,
null:
true
,
...
...
@@ -53,6 +57,10 @@ module Types
description:
'Pipelines of the commit ordered latest first.'
,
resolver:
Resolvers
::
CommitPipelinesResolver
markdown_field
:title_html
,
null:
true
markdown_field
:full_title_html
,
null:
true
markdown_field
:description_html
,
null:
true
def
author_gravatar
GravatarService
.
new
.
execute
(
object
.
author_email
,
40
)
end
...
...
app/graphql/types/group_type.rb
View file @
62a0a203
...
...
@@ -176,15 +176,6 @@ module Types
null:
true
,
description:
'Dependency proxy TTL policy for the group.'
def
label
(
title
:)
BatchLoader
::
GraphQL
.
for
(
title
).
batch
(
key:
group
)
do
|
titles
,
loader
,
args
|
LabelsFinder
.
new
(
current_user
,
group:
args
[
:key
],
title:
titles
)
.
execute
.
each
{
|
label
|
loader
.
call
(
label
.
title
,
label
)
}
end
end
field
:labels
,
Types
::
LabelType
.
connection_type
,
null:
true
,
...
...
@@ -221,6 +212,15 @@ module Types
description:
'Work item types available to the group.'
,
feature_flag: :work_items
def
label
(
title
:)
BatchLoader
::
GraphQL
.
for
(
title
).
batch
(
key:
group
)
do
|
titles
,
loader
,
args
|
LabelsFinder
.
new
(
current_user
,
group:
args
[
:key
],
title:
titles
)
.
execute
.
each
{
|
label
|
loader
.
call
(
label
.
title
,
label
)
}
end
end
def
avatar_url
object
.
avatar_url
(
only_path:
false
)
end
...
...
app/graphql/types/issue_type.rb
View file @
62a0a203
...
...
@@ -21,10 +21,8 @@ module Types
description:
"Internal ID of the issue."
field
:title
,
GraphQL
::
Types
::
String
,
null:
false
,
description:
'Title of the issue.'
markdown_field
:title_html
,
null:
true
field
:description
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Description of the issue.'
markdown_field
:description_html
,
null:
true
field
:state
,
IssueStateEnum
,
null:
false
,
description:
'State of the issue.'
...
...
@@ -143,6 +141,9 @@ module Types
field
:escalation_status
,
Types
::
IncidentManagement
::
EscalationStatusEnum
,
null:
true
,
description:
'Escalation status of the issue.'
markdown_field
:title_html
,
null:
true
markdown_field
:description_html
,
null:
true
def
author
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
User
,
object
.
author_id
).
find
end
...
...
app/graphql/types/label_type.rb
View file @
62a0a203
...
...
@@ -12,7 +12,6 @@ module Types
description:
'Label ID.'
field
:description
,
GraphQL
::
Types
::
String
,
null:
true
,
description:
'Description of the label (Markdown rendered as HTML for caching).'
markdown_field
:description_html
,
null:
true
field
:title
,
GraphQL
::
Types
::
String
,
null:
false
,
description:
'Content of the label.'
field
:color
,
GraphQL
::
Types
::
String
,
null:
false
,
...
...
@@ -23,5 +22,7 @@ module Types
description:
'When this label was created.'
field
:updated_at
,
Types
::
TimeType
,
null:
false
,
description:
'When this label was last updated.'
markdown_field
:description_html
,
null:
true
end
end
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