Skip to content

review cyclomatic complexity of Python scripts and refactor where needed #765

@mmguero

Description

@mmguero

radon can be used to evaluate the cyclomatic complexity of code and give it a grade (A-F).

For example:

$ radon cc -s shared/bin/extracted_files_http_server.py 
shared/bin/extracted_files_http_server.py
    M 78:4 HTTPHandler.do_GET - F (83)
    C 69:0 HTTPHandler - F (43)
    F 520:0 serve_on_port - A (5)
    F 541:0 main - A (5)
    F 56:0 LocalFilesForZip - A (2)
    M 71:4 HTTPHandler.translate_path - A (1)

We should run this on all our python code (e.g., find . -type f -name "*.py" -print0 | xargs -I "XXX" -0 radon cc -s "XXX") and refactor where necessary.

Metadata

Metadata

Assignees

Labels

codeIssues for code cleanup/refactoring/technical debt

Type

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions