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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
239b2748
Commit
239b2748
authored
Oct 20, 2017
by
Maxim Rydkin
Committed by
Rémy Coutable
Oct 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decrease Perceived Complexity threshold to 14
parent
8c79310e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
.rubocop.yml
.rubocop.yml
+1
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+21
-8
changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step3.yml
...d/31358_decrease_perceived_complexity_threshold_step3.yml
+5
-0
No files found.
.rubocop.yml
View file @
239b2748
...
@@ -665,7 +665,7 @@ Metrics/ParameterLists:
...
@@ -665,7 +665,7 @@ Metrics/ParameterLists:
# A complexity metric geared towards measuring complexity for a human reader.
# A complexity metric geared towards measuring complexity for a human reader.
Metrics/PerceivedComplexity
:
Metrics/PerceivedComplexity
:
Enabled
:
true
Enabled
:
true
Max
:
1
5
Max
:
1
4
# Lint ########################################################################
# Lint ########################################################################
...
...
app/helpers/projects_helper.rb
View file @
239b2748
...
@@ -15,7 +15,7 @@ module ProjectsHelper
...
@@ -15,7 +15,7 @@ module ProjectsHelper
end
end
def
link_to_member_avatar
(
author
,
opts
=
{})
def
link_to_member_avatar
(
author
,
opts
=
{})
default_opts
=
{
size:
16
}
default_opts
=
{
size:
16
,
lazy_load:
false
}
opts
=
default_opts
.
merge
(
opts
)
opts
=
default_opts
.
merge
(
opts
)
classes
=
%W[avatar avatar-inline s
#{
opts
[
:size
]
}
]
classes
=
%W[avatar avatar-inline s
#{
opts
[
:size
]
}
]
...
@@ -27,8 +27,26 @@ module ProjectsHelper
...
@@ -27,8 +27,26 @@ module ProjectsHelper
image_tag
(
src
,
width:
opts
[
:size
],
class:
classes
,
alt:
''
,
"data-src"
=>
avatar
)
image_tag
(
src
,
width:
opts
[
:size
],
class:
classes
,
alt:
''
,
"data-src"
=>
avatar
)
end
end
def
author_content_tag
(
author
,
opts
=
{})
default_opts
=
{
author_class:
'author'
,
tooltip:
false
,
by_username:
false
}
opts
=
default_opts
.
merge
(
opts
)
has_tooltip
=
!
opts
[
:by_username
]
&&
opts
[
:tooltip
]
username
=
opts
[
:by_username
]
?
author
.
to_reference
:
author
.
name
name_tag_options
=
{
class:
[
opts
[
:author_class
]]
}
if
has_tooltip
name_tag_options
[
:title
]
=
author
.
to_reference
name_tag_options
[
:data
]
=
{
placement:
'top'
}
name_tag_options
[
:class
]
<<
'has-tooltip'
end
content_tag
(
:span
,
sanitize
(
username
),
name_tag_options
)
end
def
link_to_member
(
project
,
author
,
opts
=
{},
&
block
)
def
link_to_member
(
project
,
author
,
opts
=
{},
&
block
)
default_opts
=
{
avatar:
true
,
name:
true
,
size:
16
,
author_class:
'author'
,
title:
":name"
,
tooltip:
false
,
lazy_load:
false
}
default_opts
=
{
avatar:
true
,
name:
true
,
title:
":name"
}
opts
=
default_opts
.
merge
(
opts
)
opts
=
default_opts
.
merge
(
opts
)
return
"(deleted)"
unless
author
return
"(deleted)"
unless
author
...
@@ -39,12 +57,7 @@ module ProjectsHelper
...
@@ -39,12 +57,7 @@ module ProjectsHelper
author_html
<<
link_to_member_avatar
(
author
,
opts
)
if
opts
[
:avatar
]
author_html
<<
link_to_member_avatar
(
author
,
opts
)
if
opts
[
:avatar
]
# Build name span tag
# Build name span tag
if
opts
[
:by_username
]
author_html
<<
author_content_tag
(
author
,
opts
)
if
opts
[
:name
]
author_html
<<
content_tag
(
:span
,
sanitize
(
"@
#{
author
.
username
}
"
),
class:
opts
[
:author_class
])
if
opts
[
:name
]
else
tooltip_data
=
{
placement:
'top'
}
author_html
<<
content_tag
(
:span
,
sanitize
(
author
.
name
),
class:
[
opts
[
:author_class
],
(
'has-tooltip'
if
opts
[
:tooltip
])],
title:
(
author
.
to_reference
if
opts
[
:tooltip
]),
data:
(
tooltip_data
if
opts
[
:tooltip
]))
if
opts
[
:name
]
end
author_html
<<
capture
(
&
block
)
if
block
author_html
<<
capture
(
&
block
)
if
block
...
...
changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step3.yml
0 → 100644
View file @
239b2748
---
title
:
Decrease Perceived Complexity threshold to
14
merge_request
:
14231
author
:
Maxim Rydkin
type
:
other
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