Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
1e89154a6efc
Commit
1e89154a
authored
Oct 20, 2017
by
Maxim Rydkin
Browse files
Decrease Perceived Complexity threshold to 14
parent
0b51be63cb1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
.rubocop.yml
View file @
1e89154a
...
...
@@ -665,7 +665,7 @@
# A complexity metric geared towards measuring complexity for a human reader.
Metrics/PerceivedComplexity
:
Enabled
:
true
Max
:
1
5
Max
:
1
4
# Lint ########################################################################
...
...
app/helpers/projects_helper.rb
View file @
1e89154a
...
...
@@ -15,7 +15,7 @@
end
def
link_to_member_avatar
(
author
,
opts
=
{})
default_opts
=
{
size:
16
}
default_opts
=
{
size:
16
,
lazy_load:
false
}
opts
=
default_opts
.
merge
(
opts
)
classes
=
%W[avatar avatar-inline s
#{
opts
[
:size
]
}
]
...
...
@@ -27,4 +27,22 @@
image_tag
(
src
,
width:
opts
[
:size
],
class:
classes
,
alt:
''
,
"data-src"
=>
avatar
)
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
)
...
...
@@ -30,5 +48,5 @@
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
)
return
"(deleted)"
unless
author
...
...
@@ -39,12 +57,7 @@
author_html
<<
link_to_member_avatar
(
author
,
opts
)
if
opts
[
:avatar
]
# Build name span tag
if
opts
[
:by_username
]
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
<<
author_content_tag
(
author
,
opts
)
if
opts
[
:name
]
author_html
<<
capture
(
&
block
)
if
block
...
...
changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step3.yml
0 → 100644
View file @
1e89154a
---
title
:
Decrease Perceived Complexity threshold to
14
merge_request
:
14231
author
:
Maxim Rydkin
type
:
other
Write
Preview
Supports
Markdown
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