Project

General

Profile

Cleanup #41221

mgr/dashboard: reduce method (cyclomatic) complexity

Added by Ernesto Puerta over 4 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
General - Back-end
Target version:
-
% Done:

0%

Tags:
low-hanging-fruit, good-first-issue
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

PR https://github.com/ceph/ceph/pull/28696 introduces flake8, which allows for extra checkings (naming, etc.). One of the features it provides is McCabe's cyclomatic complexity. Any method graded beyond 10 should be refactored. The following is a list of the over-complex methods.

./awsauth.py:98:5: C901 'S3Auth.get_canonical_string' is too complex (17)
./rest_client.py:191:5: C901 '_ResponseValidator._validate_array' is too complex (11)
./rest_client.py:366:5: C901 'RestClient.do_request' is too complex (19)
./controllers/pool.py:101:5: C901 'Pool._set_pool_values' is too complex (13)
./controllers/rbd.py:103:5: C901 'Rbd._rbd_image' is too complex (11)
./controllers/rbd.py:259:5: C901 'Rbd.set' is too complex (11)
./controllers/rbd_mirroring.py:42:1: C901 'get_daemons_and_pools' is too complex (32)
./controllers/__init__.py:27:1: C901 'EndpointDoc' is too complex (24)
./controllers/__init__.py:188:1: C901 'Endpoint' is too complex (16)
./controllers/__init__.py:418:5: C901 'Task.__call__' is too complex (13)
./controllers/__init__.py:750:5: C901 'RESTController.endpoints' is too complex (18)
./controllers/iscsi.py:30:5: C901 'IscsiUi.status' is too complex (12)
./controllers/iscsi.py:79:5: C901 'IscsiUi.overview' is too complex (16)
./controllers/iscsi.py:259:5: C901 'IscsiTarget._delete' is too complex (12)
./controllers/iscsi.py:419:5: C901 'IscsiTarget._validate' is too complex (20)
./controllers/iscsi.py:541:5: C901 'IscsiTarget._create' is too complex (21)
./controllers/docs.py:250:5: C901 'Docs._gen_paths' is too complex (12)
./controllers/mgr_modules.py:146:5: C901 'MgrModules._convert_module_options' is too complex (12)
./controllers/cephfs.py:125:5: C901 'CephFS.fs_status' is too complex (14)
./controllers/osd.py:17:5: C901 'Osd.list' is too complex (12)
./services/ganesha.py:592:5: C901 'Export.validate' is too complex (14)
./services/ganesha.py:672:5: C901 'Export.to_export_block' is too complex (12)
./services/ganesha.py:872:5: C901 'GaneshaConf.validate' is too complex (12)
./services/sso.py:137:1: C901 'handle_sso_command' is too complex (23)
./services/exception.py:18:1: C901 'If 18' is too complex (13)
./services/tcmu_service.py:9:5: C901 'TcmuService.get_iscsi_info' is too complex (11)
./tests/__init__.py:145:5: C901 'ControllerTestCase._task_request' is too complex (13)
27    C901 'S3Auth.get_canonical_string' is too complex (17)

History

#1 Updated by Ernesto Puerta about 3 years ago

  • Tags set to low-hanging-fruit

#2 Updated by Ernesto Puerta almost 3 years ago

  • Project changed from mgr to Dashboard
  • Category changed from 146 to General - Back-end

#3 Updated by Deepika Upadhyay over 2 years ago

  • Tags changed from low-hanging-fruit to low-hanging-fruit, good-first-issue

#4 Updated by Deepika Upadhyay over 2 years ago

  • Tags changed from low-hanging-fruit to low-hanging-fruit, good-first-issue

#5 Updated by Anonymous almost 2 years ago

I would like to take up this task. Kindly assign the issue to me!

#6 Updated by Ernesto Puerta almost 2 years ago

  • Status changed from New to Resolved
  • Pull request ID set to 45007

Also available in: Atom PDF