Mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or “duck”) typing and static typing. Mypy combines the expressive power and convenience of Python with a powerful type system and compile-time type checking.

This rule checks whether Mypy finds any type issues when running it on all Python files in this project.

Per default, mllint is configured to make Mypy enforce static typing.

The score for this rule is determined as a function of the number of messages Mypy returns and the lines of Python code that your project has. In the ideal case, Mypy does not recognise any code smells in your project, in which case the score is 100%. When there is one Mypy issue for every 20 lines of code, then the score is 50%. When there is one Mypy issue for every 10 lines of code, then the score is 0%.

More specifically, in pseudocode, score = 100 - 100 * min(1, 10 * number of msgs / lines of code). Note that the measured amount of lines of code includes any non-hidden Python files in the repository, including those that are ignored by Mypy.

To learn more about how type-checking works and how to use it in Python, see: