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

refactor(mypy): add stricter rules to specific modules [part I/VI] #969

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

glevco
Copy link
Contributor

@glevco glevco commented Mar 13, 2024

Depends on #967

Motivation

We currently use a subset of static typing rules with mypy, for historic reasons. The aim should be to enable strict=True in the whole repo, or at least most of it. One way to do this incrementally is to configure a mypy override with stricter rules and set it for some specific modules.

This PR does this for some newer or important modules. We cannot use strict=True directly, because this rule is not available on per-module configs. Therefore, we get all strict rules from the mypy documentation and manually configure them.

Acceptance Criteria

  • Update mypy and mypy-zope.
  • Configure stricter mypy for some specific modules and update those modules to conform.
  • Some other minor typing/style changes.

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@glevco glevco self-assigned this Mar 13, 2024
@glevco glevco mentioned this pull request Mar 13, 2024
1 task
@glevco glevco force-pushed the refactor/hash-property branch from 43eb06d to 5916646 Compare March 13, 2024 16:02
@glevco glevco force-pushed the refactor/strict-mypy branch 5 times, most recently from 0bc534b to 27011cb Compare March 14, 2024 16:00
@glevco glevco changed the title refactor: strict mypy refactor(mypy): add stricter rules to specific modules Mar 14, 2024
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 85.15%. Comparing base (8ed3e4b) to head (0d3deb6).

Files Patch % Lines
hathor/event/websocket/protocol.py 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #969      +/-   ##
==========================================
+ Coverage   85.12%   85.15%   +0.02%     
==========================================
  Files         294      294              
  Lines       22783    22789       +6     
  Branches     3430     3432       +2     
==========================================
+ Hits        19395    19405      +10     
+ Misses       2707     2703       -4     
  Partials      681      681              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@glevco glevco changed the title refactor(mypy): add stricter rules to specific modules refactor(mypy): add stricter rules to specific modules [part i/iv] Mar 14, 2024
@glevco glevco changed the title refactor(mypy): add stricter rules to specific modules [part i/iv] refactor(mypy): add stricter rules to specific modules [part i/vi] Mar 14, 2024
@glevco glevco changed the title refactor(mypy): add stricter rules to specific modules [part i/vi] refactor(mypy): add stricter rules to specific modules [part I/VI] Mar 14, 2024
@glevco glevco marked this pull request as ready for review March 19, 2024 00:46
msbrogli
msbrogli previously approved these changes Mar 19, 2024
@glevco glevco force-pushed the refactor/hash-property branch from 5916646 to 6c494e6 Compare March 19, 2024 16:28
@glevco glevco force-pushed the refactor/strict-mypy branch from 27011cb to 0f107df Compare March 19, 2024 16:29
jansegre
jansegre previously approved these changes Mar 19, 2024
Copy link
Member

@jansegre jansegre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Base automatically changed from refactor/hash-property to master March 19, 2024 18:49
@glevco glevco dismissed stale reviews from jansegre and msbrogli March 19, 2024 18:49

The base branch was changed.

@glevco glevco force-pushed the refactor/strict-mypy branch from 0f107df to 0d3deb6 Compare March 19, 2024 18:50
@glevco glevco merged commit 2b32edc into master Mar 19, 2024
12 checks passed
@glevco glevco deleted the refactor/strict-mypy branch March 19, 2024 20:50
@jansegre jansegre mentioned this pull request Apr 5, 2024
2 tasks
@jansegre jansegre mentioned this pull request May 8, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants