Skip to content
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

Tests fail while linting with C901 (cyclomatic complexity) #265

Open
vladan opened this issue Jan 24, 2022 · 1 comment
Open

Tests fail while linting with C901 (cyclomatic complexity) #265

vladan opened this issue Jan 24, 2022 · 1 comment

Comments

@vladan
Copy link

vladan commented Jan 24, 2022

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

@mhoffm-aiven
Copy link
Contributor

proposition: we could increase the linter threshold to ~13 and refactor the yield table function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants