Skip to main content

A flake8 extension that checks for type annotations coverage

Project description

flake8-annotations-coverage

Build Status Maintainability Test Coverage

An extension for flake8 to report on files with a lot of code without type annotations.

This is mostly useful when you add type annotations to existing large codebase and want to know if new code in annotated modules is annotated.

Minimal annotations coverage percentage for each file can be configured via --min-coverage-percents option, default is 75.

Function is treated as annotated if it has annotation for at least one argument or return type. This is enough for mypy to threat the function not as dynamically typed.

Installation

pip install flake8-annotations-coverage

Example

Sample file:

# test.py

def annotated_function(some_arg: int):
    pass


def unannotated_function():
    pass

Usage:

$ flake8 test.py
test.py:0:1: TAE001 too few type annotations

Error codes

Error code Description
TAE001 Too few type annotations in file

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.
  2. Create a pull request. Make sure all checks are green.
  3. Fix review comments if any.
  4. Be awesome.

Here are useful tips:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_annotations_coverage-0.0.6.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_annotations_coverage-0.0.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file flake8_annotations_coverage-0.0.6.tar.gz.

File metadata

  • Download URL: flake8_annotations_coverage-0.0.6.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for flake8_annotations_coverage-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b94d34b35e558be23991d14f685a13a4a77a46c16586f9bbff90b40c13724ce1
MD5 62f0bf3dbe1b43ca0950aaa0d98f5dff
BLAKE2b-256 45c4b886d34b99909a65eb2d2be6aca8359a2826b436f4635ed58807a31f7524

See more details on using hashes here.

File details

Details for the file flake8_annotations_coverage-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: flake8_annotations_coverage-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for flake8_annotations_coverage-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9662ca85d4b40acbe683bb87fa08d9ff28e28b2aab3d2403974b09a9ee5f6a04
MD5 92c30e34dda6edd7ebe5186a41b77200
BLAKE2b-256 e77fb29442bd2697219d7b31ba9bd166e6277cff046621d8ca85ade57b3d36c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page