Decrease CyclomaticComplexity threshold step by step (from 17 to 10)
Description
By analogy with gitlab-foss#28202 (moved) and gitlab-foss#31358 (moved) let's planning 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 2 Oct 2017):
-
Step to 16 -
refactor lib/gitlab/google_code_import/importer.rb:163:7
CyclomaticComplexity = 17 - gitlab-foss!10928 (merged)
-
-
Step to 15 - gitlab-foss!13905 (merged) - no offences in CE and EE
-
Step to 14 - gitlab-foss!13972 (merged) -
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-foss!14152 (merged) -
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-foss!14232 -
refactor app/helpers/projects_helper.rb:30:3
CyclomaticComplexity = 13 - gitlab-foss!14231 -
refactor app/services/merge_requests/update_service.rb:24:5
CyclomaticComplexity = 13 -
refactor app/controllers/autocomplete_controller.rb:8:3
- EE CyclomaticComplexity = 13 - gitlab-foss!13778 (merged) -
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:145: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/diff/parser.rb:6:7
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: gitlab-foss2278656 gitlab-foss506179 meta in GitLab FOSS