{"id":25869956,"url":"https://github.com/melevir/flake8-cognitive-complexity","last_synced_at":"2025-03-17T16:12:14.512Z","repository":{"id":57429939,"uuid":"218703283","full_name":"Melevir/flake8-cognitive-complexity","owner":"Melevir","description":"An extension for flake8 that validates cognitive functions complexity","archived":false,"fork":false,"pushed_at":"2021-02-24T05:24:21.000Z","size":20,"stargazers_count":69,"open_issues_count":6,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T05:32:58.397Z","etag":null,"topics":["code-complexity","code-style","complexity","flake8","flake8-plugin","styleguide"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Melevir.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}},"created_at":"2019-10-31T06:56:12.000Z","updated_at":"2025-02-25T12:17:27.000Z","dependencies_parsed_at":"2022-08-26T04:42:55.305Z","dependency_job_id":null,"html_url":"https://github.com/Melevir/flake8-cognitive-complexity","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-cognitive-complexity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-cognitive-complexity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-cognitive-complexity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melevir%2Fflake8-cognitive-complexity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Melevir","download_url":"https://codeload.github.com/Melevir/flake8-cognitive-complexity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066189,"owners_count":20392406,"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":["code-complexity","code-style","complexity","flake8","flake8-plugin","styleguide"],"created_at":"2025-03-02T05:29:20.208Z","updated_at":"2025-03-17T16:12:14.490Z","avatar_url":"https://github.com/Melevir.png","language":"Python","readme":"# flake8-cognitive-complexity\n\n[![Build Status](https://travis-ci.org/Melevir/flake8-cognitive-complexity.svg?branch=master)](https://travis-ci.org/Melevir/flake8-cognitive-complexity)\n[![Maintainability](https://api.codeclimate.com/v1/badges/579738d149e489c631a6/maintainability)](https://codeclimate.com/github/Melevir/flake8-cognitive-complexity/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/579738d149e489c631a6/test_coverage)](https://codeclimate.com/github/Melevir/flake8-cognitive-complexity/test_coverage)\n[![PyPI version](https://badge.fury.io/py/flake8-cognitive-complexity.svg)](https://badge.fury.io/py/flake8-cognitive-complexity)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-cognitive-complexity)\n\nAn extension for flake8 that validates cognitive functions complexity.\n\nCognitive complexity is analog of cyclomatic complexity, that measure\nhow difficult to understand piece of code. Introduced by [G. Ann Campbell](https://github.com/ganncamp)\nand currently used by SonarSource, CodeClimate and others.\nYou can find more readings about cognitive complexity in\n[cognitive-complexity readme file](https://github.com/Melevir/cognitive_complexity/blob/master/README.md#what-is-cognitive-complexity).\n\nDefault complexity is 7, can be configured via `--max-cognitive-complexity` option.\n\n## Installation\n\n```terminal\npip install flake8-cognitive-complexity\n```\n\n## Example\n\n```python\ndef f(a, b):\n    if a:\n        for i in range(b):\n            if b:\n                return 1\n```\n\nUsage:\n\n```terminal\n$ flake8 --max-cognitive-complexity=3 test.py\ntext.py:1:5: CCR001 Cognitive complexity is too high (6 \u003e 3)\n```\n\nTested on Python 3.7.x and flake8 3.7.8.\n\n## Error codes\n\n| Error code |                     Description          |\n|:----------:|:----------------------------------------:|\n|   CCR001   | Cognitive complexity is too high (X \u003e Y) |\n\n## Contributing\n\nWe would love you to contribute to our project. It's simple:\n\n- Create an issue with bug you found or proposal you have. Wait for\n  approve from maintainer.\n- Create a pull request. Make sure all checks are green.\n- Fix review comments if any.\n- Be awesome.\n\nHere are useful tips:\n\n- You can run all checks and tests with `make check`. Please do it\n  before TravisCI does.\n- We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md).\n- We respect [Django CoC](https://www.djangoproject.com/conduct/).\n  Make soft, not bullshit.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelevir%2Fflake8-cognitive-complexity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelevir%2Fflake8-cognitive-complexity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelevir%2Fflake8-cognitive-complexity/lists"}