Skip to content

Fix CLI exit status when complexity threshold is met - #122

Open
Aschenbath wants to merge 1 commit into
PyCQA:masterfrom
Aschenbath:fix/cli-exit-status-107-20261120
Open

Aschenbath wants to merge 1 commit into
PyCQA:masterfrom
Aschenbath:fix/cli-exit-status-107-20261120

Conversation

@Aschenbath

Copy link
Copy Markdown

When python -m mccabe --min N prints functions meeting the threshold, it still exits successfully. Return status 1 when any function is reported, and pass that status through the module entry point. Keep status 0 for an empty report and for --dot output.

Add subprocess coverage for all three cases and document the exit status.

Fixes #107.

Validation: the reporting regression fails on the unchanged base and all three CLI tests pass with this patch. The full suite gives 17 passed, 1 failed, 1 skipped on Python 3.12; the same RegressionTests.test_get_module_complexity failure occurs on unchanged master (14 passed, 1 failed, 1 skipped), where main already has complexity 8 against the test's limit of 7. The optional hypothesmith test is skipped because hypothesmith is not installed. Flake8 and git diff --check pass.

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

Successfully merging this pull request may close these issues.

Error code when there are functions with complexity greater than the threshold

1 participant