{"id":17151226,"url":"https://github.com/soda480/pybuilder-radon","last_synced_at":"2025-03-24T12:23:36.434Z","repository":{"id":46631536,"uuid":"344998672","full_name":"soda480/pybuilder-radon","owner":"soda480","description":"A pybuilder plugin that checks the cyclomatic complexity of a project using radon.","archived":false,"fork":false,"pushed_at":"2024-03-22T21:51:10.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-27T09:14:51.892Z","etag":null,"topics":["cyclomatic-complexity","plugin","pybuilder","pybuilder-plugin","python","radon"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soda480.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-06T03:47:02.000Z","updated_at":"2021-10-03T22:11:17.000Z","dependencies_parsed_at":"2024-10-14T21:47:39.762Z","dependency_job_id":null,"html_url":"https://github.com/soda480/pybuilder-radon","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soda480%2Fpybuilder-radon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soda480%2Fpybuilder-radon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soda480%2Fpybuilder-radon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soda480%2Fpybuilder-radon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soda480","download_url":"https://codeload.github.com/soda480/pybuilder-radon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245267862,"owners_count":20587512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cyclomatic-complexity","plugin","pybuilder","pybuilder-plugin","python","radon"],"created_at":"2024-10-14T21:37:32.523Z","updated_at":"2025-03-24T12:23:36.407Z","avatar_url":"https://github.com/soda480.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pybuilder-radon\n[![GitHub Workflow Status](https://github.com/soda480/pybuilder-radon/workflows/build/badge.svg)](https://github.com/soda480/pybuilder-radon/actions)\n[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://pybuilder.io/)\n[![vulnerabilities](https://img.shields.io/badge/vulnerabilities-None-brightgreen)](https://pypi.org/project/bandit/)\n[![PyPI version](https://badge.fury.io/py/pybuilder-radon.svg)](https://badge.fury.io/py/pybuilder-radon)\n[![python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-teal)](https://www.python.org/downloads/)\n\nA pybuilder plugin that checks the cyclomatic complexity of your project using `radon`. For more information about radon refer to the [radon pypi page](https://pypi.org/project/radon/).\n\nTo add this plugin into your pybuilder project, add the following line near the top of your build.py:\n```python\nuse_plugin('pypi:pybuilder_radon')\n```\n\n**NOTE** if you are using Pybuilder version `v0.11.x`, then specify the following version of the plugin:\n```python\nuse_plugin('pypi:pybuilder_radon', '~=0.1.2')\n```\n\n### cyclomatic complexity\n\nCyclomatic complexity is a software metric used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code. Cyclomatic complexity can be used to measure code complexity. The higher the complexity score the more complex the code, which typically translates to the code being more difficult to understand, maintain and to test. The number of the Cyclomatic complexity depends on how many different execution paths or control flow of your code can execute depending on various inputs. The metrics for Cyclomatic Complexity are:\n\nScore | Complexity | Risk Type\n-- | -- | --\n1 to 10 | simple | not much risk\n11 to 20 | complex | low risk\n21 to 50 | too complex | medium risk, attention\nmore than 50 | very complex | unable to test, high risk\n\nRefer to [cyclomatic complexity](https://www.c-sharpcorner.com/article/code-metrics-cyclomatic-complexity/) for more information.\n\n### Pybuilder radon properties\n\nThe pybuilder task `pyb radon` will use radon to to analyze your project and display the average cyclomatic complexity, verbose mode will display complexity of all classes, functions and methods analyzed. The following plugin properties are available to further configure the plugin's execution.\n\nName | Type | Default Value | Description\n-- | -- | -- | --\nradon_break_build_average_complexity_threshold | float | None | Fail build if overall average complexity is greater than the specified threshold\nradon_break_build_complexity_threshold | float | None | Fail build if complexity of any class, function or method exceeds the specified threshold\n\nThe plugin properties are set using `project.set_property`, for example setting the following properties, `pyb complexity` will fail if the average overall complexity score of the project exceeds `4` or if the complexity score of **any** class, method or function exceeds `10`:\n\n```Python\nproject.set_property('radon_break_build_average_complexity_threshold', 4)\nproject.set_property('radon_break_build_complexity_threshold', 10)\n```\n\n### Development\n\nClone the repository and ensure the latest version of Docker is installed on your development server.\n\nBuild the Docker image:\n```sh\ndocker image build \\\n-t pybradon:latest .\n```\n\nRun the Docker container:\n```sh\ndocker container run \\\n--rm \\\n-it \\\n-v $PWD:/code \\\npybradon:latest \\\nbash\n```\n\nExecute the build:\n```sh\npyb -X\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoda480%2Fpybuilder-radon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoda480%2Fpybuilder-radon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoda480%2Fpybuilder-radon/lists"}