McCabe Complexity

Open
#264 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Run flake8 --max-complexity=10 --select=C distarray from the repository root and inspect distarray/local/localarray.py:1601 and distarray/plotting/plotting.py:68. Exclude distarray/externals/six.py; the work is done when the two project functions no longer exceed the chosen complexity threshold and the checker output is verified.

Written by the indexing model from the issue text.

Description

enhancement prio-low

This issue on another project puts it better than I can:

McCabe complexity is a number that represents the number of different way one can traverse through a method. It is recommended that this measure never exceeds 10. Running a complexity checker on openspending results in 10 methods with too high complexity (current version). These should all be fixed to keep the code clean and maintainable.

To see the errors I would recommend installing flake8 (can run McCabe's complexity checker and more), navigating to the root of the repo and running:

flake8 --max-complexity=10 --select=C distarray

the output is:

distarray/externals/six.py:559:1: C901 'print_' is too complex (22)
distarray/local/localarray.py:1601:1: C901 'LocalArrayBinaryOperation.__call__' is too complex (10)
distarray/plotting/plotting.py:68:1: C901 'plot_array_distribution' is too complex (15)

The six stuff isn't our problem. But the other functions definitely look too complex.

This is low priority but I thought it was interesting. This might be a good issue for someone to tackle if they want to become acquainted with the codebase.

Dominant language
Python
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from enthought/distarray

All issues in enthought/distarray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.