-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High Cyclomatic complexity score #1435
Comments
Fixing this will probably require a few PRs. The first priority is probably to break up Also, as you reduce the complexity, can you put together a guide of how to write "good" functions/code? I know some projects are pretty strict about limiting the amount of indentation or lines in a function but I don't know too much about best practices |
Cool tool! Curious if you include a -a to the above command, whats' the overall score? Carbon ended up with a C. |
23 blocks (classes, functions, methods) analyzed. @14rcole, I can look for reference but what I like about this tool is that it will give absolute feedback (not an opinion). |
@14rcole Add issues on reducing complexity. |
Running
radon
on Linchpin code show bad complexity scores:reference:
https://www.guru99.com/cyclomatic-complexity.html
https://en.wikipedia.org/wiki/Cyclomatic_complexity
https://github.com/rubik/radon/
Breaking down by levels:
E
linchpin/init.py
M 460:4 LinchpinAPI.do_action - E
D
linchpin/cli/init.py
M 247:4 LinchpinCli._write_distilled_context - D
linchpin/shell/init.py
F 436:0 journal - D
linchpin/provision/library/bkr_server.py
M 47:4 BkrFactory.provision - D
linchpin/provision/library/rundb.py
F 85:0 main - D
C
linchpin/init.py
M 805:4 LinchpinAPI.get_run_data - C
M 392:4 LinchpinAPI.get_pf_data_from_rundb - C
M 239:4 LinchpinAPI.lp_journal - C
M 936:4 LinchpinAPI._invoke_playbooks - C
linchpin/InventoryFilters/JSONInventoryFormatter.py
M 48:4 JSONInventoryFormatter.add_ips_to_groups - C
linchpin/cli/init.py
M 128:4 LinchpinCli._write_to_inventory - C
M 526:4 LinchpinCli._execute_action - C
linchpin/shell/init.py
F 26:0 _handle_results - C
F 229:0 up - C
F 321:0 destroy - C
linchpin/provision/library/async_status_custom.py
F 58:0 main - C
linchpin/provision/roles/ovirt/files/inventory.py
M 53:4 Inventory.config_value_helper - C
linchpin/provision/roles/openstack/files/inventory.py
C 8:0 Inventory - C
M 11:4 Inventory.get_host_data - C
linchpin/validator/init.py
M 64:4 Validator.validate_pretty - C
M 321:4 Validator._convert_topology - C
linchpin/validator/anyofvalidator.py
M 10:4 AnyofValidator._validate_anyof - C
linchpin/fetch/fetch.py
M 62:4 Fetch.copy_dir - C
The text was updated successfully, but these errors were encountered: