Decrease Perceived Complexity threshold to 14
This commit is contained in:
parent
8c79310e27
commit
239b274855
|
@ -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: 15
|
Max: 14
|
||||||
|
|
||||||
# Lint ########################################################################
|
# Lint ########################################################################
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Decrease Perceived Complexity threshold to 14
|
||||||
|
merge_request: 14231
|
||||||
|
author: Maxim Rydkin
|
||||||
|
type: other
|
Loading…
Reference in New Issue