Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust configuration mypy #3

Merged
merged 1 commit into from
Jul 25, 2024
Merged

Adjust configuration mypy #3

merged 1 commit into from
Jul 25, 2024

Conversation

SoloJacobs
Copy link
Collaborator

The strict flag enables the following flags (the precise list depends on the mypy version, see mypy --help):

--warn-unused-configs,
--disallow-any-generics,
--disallow-subclassing-any,
--disallow-untyped-calls,
--disallow-untyped-defs,
--disallow-incomplete-defs,
--check-untyped-defs,
--disallow-untyped-decorators,
--warn-redundant-casts,
--warn-unused-ignores,
--warn-return-any,
--no-implicit-reexport,
--strict-equality,
--extra-checks

This means mypy accepts the following code as valid:

import typing

def ignore_without_code() -> int:
    return "a"  # type: ignore

def redundant_expr(x: int) -> int:
    return 1 if isinstance(x, int) else 2

def possible_undefined(x: int) -> int:
    if x > 0:
        result = 1
    return result

def any_explicit(_x: typing.Any) -> None:
    pass

def any_expr() -> None:
    a = x  # type: ignore[name-defined]

The strict flag enables the following flags (the precise list
depends on the mypy version, see mypy --help):

  --warn-unused-configs,
  --disallow-any-generics,
  --disallow-subclassing-any,
  --disallow-untyped-calls,
  --disallow-untyped-defs,
  --disallow-incomplete-defs,
  --check-untyped-defs,
  --disallow-untyped-decorators,
  --warn-redundant-casts,
  --warn-unused-ignores,
  --warn-return-any,
  --no-implicit-reexport,
  --strict-equality,
  --extra-checks

This means mypy accepts the following code as valid:

```
import typing

def ignore_without_code() -> int:
    return "a"  # type: ignore

def redundant_expr(x: int) -> int:
    return 1 if isinstance(x, int) else 2

def possible_undefined(x: int) -> int:
    if x > 0:
        result = 1
    return result

def any_explicit(_x: typing.Any) -> None:
    pass

def any_expr() -> None:
    a = x  # type: ignore[name-defined]
```
@SoloJacobs SoloJacobs requested a review from jherbel July 25, 2024 06:49
@SoloJacobs SoloJacobs merged commit cd212d3 into Checkmk:main Jul 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants