UCLH-Foundry / PIXL

PIXL Image eXtraction Laboratory
Apache License 2.0
8 stars 0 forks source link

Fix mypy in pre-commit #350

Closed jeremyestein closed 4 months ago

jeremyestein commented 5 months ago

Fixes #305

I wish I understood why this worked, but at least mypy is giving reasonable looking errors with it now.

I'll leave this PR as a starting point for the next person who picks this up - I assume we want to fix all the errors as part of the fix? (Remember to merge/rebase first though)

According to https://github.com/pre-commit/mirrors-mypy/blob/main/.pre-commit-hooks.yaml the default value is entry: mypy. However, running the command line mypy manually does show some errors, so this is not the whole story!

pre-commit does run commands inside its own environment so it's possible that has an effect.

So, to summarise: command result
mypy Found 13 errors in 6 files (checked 71 source files)
mypy . Found 67 errors in 23 files (checked 66 source files)
(without "entry" fix) pre-commit run --all-files --verbose Success: no issues found in 71 source files
(with "entry" fix) - pre-commit run --all-files --verbose Found 59 errors in 18 files (checked 66 source files)

Make that make sense!

(mypy.ini is being read in all cases - put in a bad config option and it'll warn you)

milanmlft commented 5 months ago

So confusing 🙈

milanmlft commented 4 months ago

Fixed all remaining mypy errors.