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

high cyclomatic complexity scores #387

Open
jvavrek opened this issue Feb 16, 2024 · 0 comments
Open

high cyclomatic complexity scores #387

jvavrek opened this issue Feb 16, 2024 · 0 comments
Milestone

Comments

@jvavrek
Copy link
Contributor

jvavrek commented Feb 16, 2024

We should aim to reduce the cyclomatic complexity of some of our code to around 20 or below:

❯ 🅒 myenv jvavrek in becquerel on  main flake8 . --max-complexity=20
./becquerel/core/calibration.py:180:1: C901 '_validate_expression' is too complex (21)
./becquerel/core/fitting.py:750:5: C901 'Fitter.fit' is too complex (25)
./becquerel/parsers/cnf.py:78:1: C901 'read' is too complex (54)
./becquerel/parsers/iec1455.py:32:1: C901 'read' is too complex (37)
./becquerel/parsers/spc.py:182:1: C901 'read' is too complex (40)
./becquerel/parsers/spe.py:11:1: C901 'read' is too complex (27)
./becquerel/tools/nndc.py:205:1: C901 '_parse_float_uncertainty' is too complex (23)

It's mostly the read methods with high complexity scores, which is probably fine, since there are a lot of branches necessary to read different fields. But we could potentially extract out some methods to knock those scores down. And we could probably improve Fitter.fit and the other non-read methods.

@jvavrek jvavrek added this to the Someday milestone Feb 16, 2024
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

1 participant