flake8-annotations-complexity


Nameflake8-annotations-complexity JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/best-doctor/flake8-annotations-complexity
SummaryA flake8 extension that checks for type annotations complexity
upload_time2023-06-22 13:26:33
maintainer
docs_urlNone
authorIlya Lebedev
requires_python>=3.7
licenseMIT
keywords flake8 annotations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # flake8-annotations-complexity

[![Build Status](https://github.com/best-doctor/flake8-annotations-complexity/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/best-doctor/flake8-annotations-complexity/actions/workflows/build.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/c81ff76755380663b7d3/maintainability)](https://codeclimate.com/github/best-doctor/flake8-annotations-complexity/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/c81ff76755380663b7d3/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-annotations-complexity/test_coverage)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-annotations-complexity)

An extension for flake8 to report on too complex type annotations.

Complex type annotations often means bad annotations usage,
wrong code decomposition or improper data structure choice.
They are also hard to read and make code look java-like.

Annotation complexity is maximum annotation nesting level.
So `List[int]` complexity is 2 and `Tuple[List[Optional[str]], int]` is 4.

Default max annotation complexity is 3 and can be configured
via `--max-annotations-complexity` option.

## Installation

```bash
pip install flake8-annotations-complexity
```

## Example

Sample file:

```python
# test.py

def foo() -> List[int]:
    return [1]
```

Usage:

```terminal
$ flake8 --max-annotations-complexity=1 test.py
test.py:4:14: TAE002 too complex annotation (2 > 1)
```

## Contributing

We would love you to contribute to our project. It's simple:

1. Create an issue with bug you found or proposal you have.
   Wait for approve from maintainer.
1. Create a pull request. Make sure all checks are green.
1. Fix review comments if any.
1. Be awesome.

Here are useful tips:

- You can run all checks and tests with `make check`.
  Please do it before CI does.
- We use [BestDoctor python styleguide](https://github.com/best-doctor/guides/blob/master/guides/en/python_styleguide.md).
- We respect [Django CoC](https://www.djangoproject.com/conduct/).
  Make soft, not bullshit.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/best-doctor/flake8-annotations-complexity",
    "name": "flake8-annotations-complexity",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "flake8 annotations",
    "author": "Ilya Lebedev",
    "author_email": "melevir@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d0/22/95d82ddf351f3b0fe84fad532798d36797be0fb29d593b403740fe30dacc/flake8_annotations_complexity-0.0.8.tar.gz",
    "platform": null,
    "description": "# flake8-annotations-complexity\n\n[![Build Status](https://github.com/best-doctor/flake8-annotations-complexity/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/best-doctor/flake8-annotations-complexity/actions/workflows/build.yml)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c81ff76755380663b7d3/maintainability)](https://codeclimate.com/github/best-doctor/flake8-annotations-complexity/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/c81ff76755380663b7d3/test_coverage)](https://codeclimate.com/github/best-doctor/flake8-annotations-complexity/test_coverage)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-annotations-complexity)\n\nAn extension for flake8 to report on too complex type annotations.\n\nComplex type annotations often means bad annotations usage,\nwrong code decomposition or improper data structure choice.\nThey are also hard to read and make code look java-like.\n\nAnnotation complexity is maximum annotation nesting level.\nSo `List[int]` complexity is 2 and `Tuple[List[Optional[str]], int]` is 4.\n\nDefault max annotation complexity is 3 and can be configured\nvia `--max-annotations-complexity` option.\n\n## Installation\n\n```bash\npip install flake8-annotations-complexity\n```\n\n## Example\n\nSample file:\n\n```python\n# test.py\n\ndef foo() -> List[int]:\n    return [1]\n```\n\nUsage:\n\n```terminal\n$ flake8 --max-annotations-complexity=1 test.py\ntest.py:4:14: TAE002 too complex annotation (2 > 1)\n```\n\n## Contributing\n\nWe would love you to contribute to our project. It's simple:\n\n1. Create an issue with bug you found or proposal you have.\n   Wait for approve from maintainer.\n1. Create a pull request. Make sure all checks are green.\n1. Fix review comments if any.\n1. Be awesome.\n\nHere are useful tips:\n\n- You can run all checks and tests with `make check`.\n  Please do it before CI 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",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A flake8 extension that checks for type annotations complexity",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/best-doctor/flake8-annotations-complexity"
    },
    "split_keywords": [
        "flake8",
        "annotations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "860f5fc1850490364aa4f16d1fce3c5727b09c579332ba90d3fbf4e017196e0f",
                "md5": "20f7d38513977a4b8573008ae993b2e4",
                "sha256": "44e299dac0ab64f3af4b478fac7feb635c113a606036de8b39dadab3531da7ed"
            },
            "downloads": -1,
            "filename": "flake8_annotations_complexity-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20f7d38513977a4b8573008ae993b2e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5427,
            "upload_time": "2023-06-22T13:26:32",
            "upload_time_iso_8601": "2023-06-22T13:26:32.449834Z",
            "url": "https://files.pythonhosted.org/packages/86/0f/5fc1850490364aa4f16d1fce3c5727b09c579332ba90d3fbf4e017196e0f/flake8_annotations_complexity-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d02295d82ddf351f3b0fe84fad532798d36797be0fb29d593b403740fe30dacc",
                "md5": "c2267c45daeb1e451ebd8c5f3b03f73a",
                "sha256": "8914e76e31672c4063c928b0a250db6b935a16d1799de10457958a71d11bb665"
            },
            "downloads": -1,
            "filename": "flake8_annotations_complexity-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "c2267c45daeb1e451ebd8c5f3b03f73a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4797,
            "upload_time": "2023-06-22T13:26:33",
            "upload_time_iso_8601": "2023-06-22T13:26:33.887188Z",
            "url": "https://files.pythonhosted.org/packages/d0/22/95d82ddf351f3b0fe84fad532798d36797be0fb29d593b403740fe30dacc/flake8_annotations_complexity-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-22 13:26:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "best-doctor",
    "github_project": "flake8-annotations-complexity",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flake8-annotations-complexity"
}
        
Elapsed time: 0.11004s