Decrease Perceived Complexity threshold to 15

This commit is contained in:
Maxim Rydkin 2017-09-12 17:27:29 +00:00 committed by Robert Speicher
parent 467dffa631
commit e723dc13be
3 changed files with 26 additions and 13 deletions

View file

@ -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: 17 Max: 15
# Lint ######################################################################## # Lint ########################################################################

View file

@ -241,13 +241,7 @@ class Event < ActiveRecord::Base
def action_name def action_name
if push? if push?
if new_ref? push_action_name
"pushed new"
elsif rm_ref?
"deleted"
else
"pushed to"
end
elsif closed? elsif closed?
"closed" "closed"
elsif merged? elsif merged?
@ -263,11 +257,7 @@ class Event < ActiveRecord::Base
elsif commented? elsif commented?
"commented on" "commented on"
elsif created_project? elsif created_project?
if project.external_import? created_project_action_name
"imported"
else
"created"
end
else else
"opened" "opened"
end end
@ -360,6 +350,24 @@ class Event < ActiveRecord::Base
private private
def push_action_name
if new_ref?
"pushed new"
elsif rm_ref?
"deleted"
else
"pushed to"
end
end
def created_project_action_name
if project.external_import?
"imported"
else
"created"
end
end
def recent_update? def recent_update?
project.last_activity_at > RESET_PROJECT_ACTIVITY_INTERVAL.ago project.last_activity_at > RESET_PROJECT_ACTIVITY_INTERVAL.ago
end end

View file

@ -0,0 +1,5 @@
---
title: Decrease Perceived Complexity threshold to 15
merge_request: 14160
author: Maxim Rydkin
type: other