diff options
author | Maxim Rydkin <maks.rydkin@gmail.com> | 2017-09-12 17:27:29 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-09-12 17:27:29 +0000 |
commit | e723dc13be1e2e90fcf3ac9b97e8d159572f1d01 (patch) | |
tree | 1a48adaf037586903e58400b7a2778b550d66b56 | |
parent | 467dffa631e91e206f5835cc6d1fdb7bb3b112e0 (diff) | |
download | gitlab-ce-e723dc13be1e2e90fcf3ac9b97e8d159572f1d01.tar.gz |
Decrease Perceived Complexity threshold to 15
-rw-r--r-- | .rubocop.yml | 2 | ||||
-rw-r--r-- | app/models/event.rb | 32 | ||||
-rw-r--r-- | changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step2.yml | 5 |
3 files changed, 26 insertions, 13 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index dc97a61b4a6..dbeb1880d39 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -665,7 +665,7 @@ Metrics/ParameterLists: # A complexity metric geared towards measuring complexity for a human reader. Metrics/PerceivedComplexity: Enabled: true - Max: 17 + Max: 15 # Lint ######################################################################## diff --git a/app/models/event.rb b/app/models/event.rb index 8e9490b66f4..0b1f053a7e6 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -241,13 +241,7 @@ class Event < ActiveRecord::Base def action_name if push? - if new_ref? - "pushed new" - elsif rm_ref? - "deleted" - else - "pushed to" - end + push_action_name elsif closed? "closed" elsif merged? @@ -263,11 +257,7 @@ class Event < ActiveRecord::Base elsif commented? "commented on" elsif created_project? - if project.external_import? - "imported" - else - "created" - end + created_project_action_name else "opened" end @@ -360,6 +350,24 @@ class Event < ActiveRecord::Base 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? project.last_activity_at > RESET_PROJECT_ACTIVITY_INTERVAL.ago end diff --git a/changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step2.yml b/changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step2.yml new file mode 100644 index 00000000000..6036e1a43a0 --- /dev/null +++ b/changelogs/unreleased/31358_decrease_perceived_complexity_threshold_step2.yml @@ -0,0 +1,5 @@ +--- +title: Decrease Perceived Complexity threshold to 15 +merge_request: 14160 +author: Maxim Rydkin +type: other |