Commit 04fcf3fa authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '31362_decrease_cyclomatic_complexity_threshold_step1' into 'master'

Decrease Cyclomatic Complexity threshold to 16

See merge request !10928
parents 081dfc45 37c2c4a4
...@@ -562,7 +562,7 @@ Metrics/ClassLength: ...@@ -562,7 +562,7 @@ Metrics/ClassLength:
# of test cases needed to validate a method. # of test cases needed to validate a method.
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Enabled: true Enabled: true
Max: 17 Max: 16
# Limit lines to 80 characters. # Limit lines to 80 characters.
Metrics/LineLength: Metrics/LineLength:
......
---
title: Decrease Cyclomatic Complexity threshold to 16
merge_request: 10928
author: Rydkin Maxim
module Gitlab module Gitlab
module GoogleCodeImport module GoogleCodeImport
class Importer class Importer
attr_reader :project, :repo attr_reader :project, :repo, :closed_statuses
NICE_LABEL_COLOR_HASH =
{
'Status: New' => '#428bca',
'Status: Accepted' => '#5cb85c',
'Status: Started' => '#8e44ad',
'Priority: Critical' => '#ffcfcf',
'Priority: High' => '#deffcf',
'Priority: Medium' => '#fff5cc',
'Priority: Low' => '#cfe9ff',
'Type: Defect' => '#d9534f',
'Type: Enhancement' => '#44ad8e',
'Type: Task' => '#4b6dd0',
'Type: Review' => '#8e44ad',
'Type: Other' => '#7f8c8d'
}.freeze
def initialize(project) def initialize(project)
@project = project @project = project
...@@ -161,44 +177,18 @@ module Gitlab ...@@ -161,44 +177,18 @@ module Gitlab
end end
def nice_label_color(name) def nice_label_color(name)
NICE_LABEL_COLOR_HASH[name] ||
case name case name
when /\AComponent:/ when /\AComponent:/
"#fff39e" '#fff39e'
when /\AOpSys:/ when /\AOpSys:/
"#e2e2e2" '#e2e2e2'
when /\AMilestone:/ when /\AMilestone:/
"#fee3ff" '#fee3ff'
when *closed_statuses.map { |s| nice_status_name(s) }
when "Status: New" '#cfcfcf'
"#428bca"
when "Status: Accepted"
"#5cb85c"
when "Status: Started"
"#8e44ad"
when "Priority: Critical"
"#ffcfcf"
when "Priority: High"
"#deffcf"
when "Priority: Medium"
"#fff5cc"
when "Priority: Low"
"#cfe9ff"
when "Type: Defect"
"#d9534f"
when "Type: Enhancement"
"#44ad8e"
when "Type: Task"
"#4b6dd0"
when "Type: Review"
"#8e44ad"
when "Type: Other"
"#7f8c8d"
when *@closed_statuses.map { |s| nice_status_name(s) }
"#cfcfcf"
else else
"#e2e2e2" '#e2e2e2'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment