-
Notifications
You must be signed in to change notification settings - Fork 12
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
Apply assorted repo-review rules #191
Conversation
2908dc9
to
9644093
Compare
49d3dfb
to
c585ce5
Compare
I don't understand the MyPy errors in CI: MyPy 1.11.1 errors in CI
I cannot reproduce them locally: $ python -m mypy --pretty --show-error-context src
Success: no issues found in 21 source files
$
$ mypy --version
mypy 1.11.1 (compiled: yes)
$ Perhaps related to pinned-down versions of dependencies?
|
34d2ff4
to
670ee2a
Compare
MY104: MyPy enables ignore-without-code Must have "ignore-without-code" in enable_error_code = [...]. This will force all skips in your project to include the error code, which makes them more readable, and avoids skipping something unintended. MY105: MyPy enables redundant-expr Must have "redundant-expr" in enable_error_code = [...]. This helps catch useless lines of code, like checking the same condition twice. MY106: MyPy enables truthy-bool Must have "truthy-bool" in enable_error_code = []. This catches mistakes in using a value as truthy if it cannot be falsey.
Disable many rules for now, they can be enabled later on.
bc3954b
to
e9f45f8
Compare
Thank you very much! So with this |
If you know a good markdown linter or formatter alternative, happy to add it in the list of known list.
No, you need something that reads python files for that. There are several options, but I'm personally waiting to see what the Ruff team produces. They are working on a type checker; last I heard it was going to be part of Ruff (and the prototype is part of Ruff), though I'm curious to see if they stick with that - Ruff famously doesn't require or use any dependencies, but a type checker does need dependencies and stub files. |
I haven't tested mdformat yet so I cannot voucher for it, but it comes from the executable books folk, which usually do nice stuff. |
This PR modifies the MyPy options so that MyPy catches unused type: ignore annotations when run. However, I don't see pre-commit running MyPy; it would probably involve adding this hook: https://github.com/pre-commit/mirrors-mypy. On the other hand, one of the GitHub CI jobs does run MyPy — maybe through tox, I don't know how it's done. |
I'm a bit worried about mdformat. It's not been touched in months. It seems to be worked on by the author of tomli, who's not make a public commit since April. It does have plugins for lots of things, but the plugin system isn't configurable; this is particularly bad when some plugins change the target (what happens if mdformat-gfm and mdformat-rtd are both installed?). Happy to add it to the list of supported formatters, but I'm probably not going to propose it as an alternative just yet. I know people at executable books, so might ask around. |
Follow-up of #187 (comment).