aiven-client
aiven-client copied to clipboard
Tests fail while linting with C901 (cyclomatic complexity)
What happened?
Linting started failing on python 3.10 with:
+ make test
make[3]: Entering directory '/var/home/vladan/rpmbuild/BUILD/aiven-client'
fatal: not a git repository (or any parent up to mount point /var/home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /var/home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /var/home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
python3 -m flake8 aiven tests
aiven/client/client.py:1619:5: C901 'AivenClient.create_project' is too complex (12)
aiven/client/client.py:1675:5: C901 'AivenClient.update_project' is too complex (12)
aiven/client/client.py:1854:5: C901 'AivenClient.create_billing_group' is too complex (13)
aiven/client/client.py:1908:5: C901 'AivenClient.update_billing_group' is too complex (14)
aiven/client/cli.py:205:5: C901 'AivenCLI.create_user_config' is too complex (13)
aiven/client/cli.py:846:5: C901 'AivenCLI.service__plans' is too complex (12)
aiven/client/cli.py:1840:5: C901 'AivenCLI.service__user_creds_download' is too complex (11)
aiven/client/cli.py:3743:5: C901 'AivenCLI.service__create' is too complex (11)
aiven/client/cli.py:3979:5: C901 'AivenCLI.service__update' is too complex (12)
aiven/client/argx.py:212:5: C901 'CommandLineTool.print_response' is too complex (13)
aiven/client/pretty.py:86:1: C901 'yield_table' is too complex (25)
aiven/client/connection_info/_utils.py:25:1: C901 'format_uri' is too complex (11)
make[3]: *** [Makefile:30: flake8] Error 1
make[3]: Leaving directory '/var/home/vladan/rpmbuild/BUILD/aiven-client'
error: Bad exit status from /var/tmp/rpm-tmp.YPXhnf (%check)
Cyclomatic complexity is something that needs to be sorted out in the listed functions.
What did you expect to happen?
Tests should have passed.
What else do we need to know?
Include your platform, version, and any other information that seems relevant.
Fedora 35 Python 3.10
proposition: we could increase the linter threshold to ~13 and refactor the yield table
function