Metadata-Version: 2.1
Name: mypy-json-report
Version: 0.1.3
Summary: Generate a JSON report from your mypy output
Home-page: https://github.com/memrise/mypy-json-report
License: Apache-2.0
Author: Charlie Denton
Author-email: charlie@meshy.co.uk
Requires-Python: >=3.7
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Project-URL: Repository, https://github.com/memrise/mypy-json-report
Description-Content-Type: text/markdown

# Mypy JSON Report

A JSON report of your mypy output
that helps you push towards full type coverage of your project.

## Quickstart

Install with pip.
```
pip install mypy-json-report
```

Pipe the output of mypy through the `mypy-json-report` CLI app.
Store the output to a file, and commit it to your git repo.

```
mypy . --strict | mypy-json-report > known-mypy-errors.json
git add known-mypy-errors.json
git commit -m "Add mypy errors lockfile"
```

Now you have a snapshot of the mypy errors in your project.
Compare against this file when making changes to your project to catch regressions and improvements.

## Example output

If mypy was showing you errors like this:

```
example.py:8: error: Function is missing a return type annotation
example.py:8: note: Use "-> None" if function does not return a value
example.py:58: error: Call to untyped function "main" in typed context
example.py:69: error: Call to untyped function "main" in typed context
Found 3 errors in 1 file (checked 3 source files)
```

Then the report would look like this:

```json
{
  "example.py": {
    "Call to untyped function \"main\" in typed context": 2,
    "Function is missing a return type annotation": 1
  }
}
```

Errors are grouped by file.
To reduce churn,
the line on which the errors occur is removed
and repeated errors are counted.

## Example usage

You could create a GitHub Action to catch regressions (or improvements).

```yaml
---
name: Mypy check

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

  mypy:
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.10"

      - name: Install Python dependencies
        run: |
          pip install mypy mypy-json-report

      - name: Run mypy
        run: |
          mypy . --strict | mypy-json-report > known-mypy-errors.json

      - name: Check for mypy changes
        run: |
          git diff --exit-code
```

