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

Turn on mypy check_untyped_defs = true #1053

Open
4 of 17 tasks
Lee-W opened this issue Apr 4, 2024 · 2 comments · May be fixed by #1054
Open
4 of 17 tasks

Turn on mypy check_untyped_defs = true #1053

Lee-W opened this issue Apr 4, 2024 · 2 comments · May be fixed by #1054

Comments

@Lee-W
Copy link
Member

Lee-W commented Apr 4, 2024

Description

mypy keeps warning us to use check_untyped_defs. When turning it on, I found out there're a few type annotation issues that could be improved and could potentially be an actual issue.


Possible Solution

Fix the type annotation error/warning one by one

Additional context

list of modules needed to be fixed by 3.21.3

  • commitizen/config/yaml_config.py
  • commitizen/commands/init.py
  • commitizen/config/toml_config.py
  • commitizen/config/json_config.py
  • commitizen/cz/base.py
  • tests/test_factory.py
  • commitizen/commands/changelog.py
  • commitizen/commands/example.py
  • commitizen/commands/commit.py
  • commitizen/git.py
  • tests/test_changelog.py
  • commitizen/cli.py
  • tests/test_cz_customize.py
  • tests/test_cz_conventional_commits.py
  • tests/test_cz_base.py
  • commitizen/commands/info.py
  • commitizen/commands/check.py

Additional context

No response

@Lee-W Lee-W linked a pull request Apr 5, 2024 that will close this issue
4 tasks
@Lee-W Lee-W self-assigned this Apr 23, 2024
@AdrianDC
Copy link
Contributor

Possible configurations, commented ones raise new errors to resolve:

--- a/pyproject.toml
+++ b/pyproject.toml
@@ -171,12 +171,19 @@ convention = "google"
 
 [tool.mypy]
 files = "commitizen"
-disallow_untyped_decorators = true
+# check_untyped_defs = true # TODO
+# disallow_any_generics = true # TODO
+# disallow_incomplete_defs = true # TODO
 disallow_subclassing_any = true
-warn_return_any = true
+# disallow_untyped_calls = true # TODO
+disallow_untyped_decorators = true
+# disallow_untyped_defs = true # TODO
+no_implicit_optional = true
+strict_equality = true
 warn_redundant_casts = true
-warn_unused_ignores = true
+warn_return_any = true
 warn_unused_configs = true
+warn_unused_ignores = true

@Lee-W Lee-W linked a pull request Aug 22, 2024 that will close this issue
4 tasks
@Lee-W
Copy link
Member Author

Lee-W commented Aug 22, 2024

Sounds like a good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants