Skip to content

Conversation

jhlegarreta
Copy link
Contributor

@jhlegarreta jhlegarreta commented Oct 10, 2025

Add the mypy flag to check untyped function bodies.

Fixes:

test/test_parser.py:292: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
test/test_parser.py:294: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
test/test_main.py:92: note:
 By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
test/test_main.py:94: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
test/test_main.py:99: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]

raised for example in:
https://github.com/nipreps/nifreeze/actions/runs/18418756623/job/52488477896?pr=271#step:8:34

Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.60%. Comparing base (9ce3492) to head (f60c07c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #273   +/-   ##
=======================================
  Coverage   74.60%   74.60%           
=======================================
  Files          28       28           
  Lines        1764     1764           
  Branches      188      188           
=======================================
  Hits         1316     1316           
  Misses        373      373           
  Partials       75       75           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhlegarreta jhlegarreta force-pushed the sty/check-untyped-defs branch from 14f31d1 to 8b66232 Compare October 10, 2025 22:23
@jhlegarreta jhlegarreta changed the title STY: Check untyped defs STY: Add the mypy flag to check untyped function bodies Oct 10, 2025
@jhlegarreta jhlegarreta force-pushed the sty/check-untyped-defs branch 11 times, most recently from 73d822e to b7025d5 Compare October 12, 2025 20:57
Add the `mypy` flag to check untyped function bodies.

Fixes:
```
test/test_parser.py:292: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
test/test_parser.py:294: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
test/test_main.py:92: note:
 By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
test/test_main.py:94: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
test/test_main.py:99: note:
 By default the bodies of untyped functions are not checked,
 consider using --check-untyped-defs  [annotation-unchecked]
```

raised for example in:
https://github.com/nipreps/nifreeze/actions/runs/18418756623/job/52488477896?pr=271#step:8:34
@jhlegarreta jhlegarreta force-pushed the sty/check-untyped-defs branch from e07ebad to f60c07c Compare October 13, 2025 21:16
@jhlegarreta
Copy link
Contributor Author

The remaining errors are related to the fact that all data classes are annotated with np.ndarray, but by default they are set to None; they should be annotated with np.ndarray | None, or be initialized with an empty array. Using np.ndarray | None results in dozens of errors since for every indexing operation mypy warns about the fact that None cannot be indexed.

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.

1 participant