Decrease CyclomaticComplexity threshold step by step (from 17 to 10)
Description
By analogy with gitlab-ce#28202 and gitlab-ce#31358 let's plan decreasing CyclomaticComplexity step by step (from 17 to 10)
2017-04-24 data:
Rubocop default level is 6
=> 146 offenses
Some statistics on different benchmarks:
- CyclomaticComplexity size
10
=> 30 offences - CyclomaticComplexity size
12
=> 11 offences - CyclomaticComplexity size
14
=> 4 offences - CyclomaticComplexity size
16
=> 1 offences
Proposal
I think that level 10
is achievable in the nearest future. So I prepared checklist for first steps.
Decrease it step by step (values in TODO were checked on 17 Oct 2017):
-
Step to 16 -
refactor lib/gitlab/google_code_import/importer.rb:163:7
CyclomaticComplexity = 17 - gitlab-ce!10928
-
-
Step to 15 - gitlab-ce!13905 - no offences in CE and EE
-
Step to 14 - gitlab-ce!13972 -
refactor app/helpers/projects_helper.rb:21:3
CyclomaticComplexity = 15 -
refactor app/services/ci/create_pipeline_service.rb:50:5
- EE CyclomaticComplexity = 15
-
-
Step to 13 - gitlab-ce!14152 -
refactor lib/gitlab/conflict/parser.rb:14:7
CyclomaticComplexity = 14 -
refactor lib/gitlab/mail_room.rb:22:7
CyclomaticComplexity = 14 -
refactor app/helpers/license_helper.rb:15:3
- EE CyclomaticComplexity = 14 - https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2874
-
-
Step to 12 - gitlab-ce!14232 -
refactor app/helpers/projects_helper.rb:30:3
CyclomaticComplexity = 13 - gitlab-ce!14231 -
refactor app/services/merge_requests/update_service.rb:24:5
CyclomaticComplexity = 13 -
refactor lib/gitlab/diff/parser.rb:6:7
CyclomaticComplexity = 13 -
refactor lib/gitlab/utils/merge_hash.rb:58:7
CyclomaticComplexity = 13 -
refactor app/controllers/autocomplete_controller.rb:8:3
- EE CyclomaticComplexity = 13 - gitlab-ce!13778 -
refactor app/controllers/concerns/issuable_collections.rb:133:3
- EE CyclomaticComplexity = 13 -
refactor app/finders/autocomplete_users_finder.rb:23:3
- EE CyclomaticComplexity = 13 -
refactor lib/gitlab/checks/change_access.rb:149:7
- EE CyclomaticComplexity = 13
-
-
Step to 11 -
refactor app/helpers/nav_helper.rb:10:3
CyclomaticComplexity = 12 -
refactor app/services/issues/update_service.rb:16:5
CyclomaticComplexity = 12 -
refactor app/services/projects/create_service.rb:7:5
CyclomaticComplexity = 12 -
refactor app/services/system_hooks_service.rb:14:3
CyclomaticComplexity = 12 -
refactor app/workers/email_receiver_worker.rb:17:3
CyclomaticComplexity = 12 -
refactor lib/declarative_policy/runner.rb:75:5
CyclomaticComplexity = 12 -
refactor lib/gitlab/google_code_import/importer.rb:235:7
CyclomaticComplexity = 12 -
refactor app/helpers/dropdowns_helper.rb:2:3
- EE CyclomaticComplexity = 12 -
refactor app/helpers/license_helper.rb:15:3
- EE CyclomaticComplexity = 12
-
Links / references
Documentation blurb
(Write the start of the documentation of this feature here, include:
- Why should someone use it; what's the underlying problem.
- What is the solution.
- How does someone use this
During implementation, this can then be copied and used as a starter for the documentation.)
Possible labels: Edge gitlab-ce3011727 gitlab-ce~41076781