Open dcherian opened 1 year ago
Most of these seem quite reasonable! And cool that there's an automated review tool.
(One that I would suggest we don't do is mypy strict mode, which is really really strict, and instead pick off some parts of that and gradually apply them through the repo..., e.g. #8198)
I worked on the pytest config in #8246. We cannot follow the suggestions exactly because:
xfail_strict = true
the xfails depend on the environment and installed versions-ra
is too noisy - it lists all the skipped and xfailed tests. The default of -rfE
(report failures and errors) is better for usHi @dcherian I've reviewed the open issues. Before diving in, I wanted to reach out and confirm if the issue is still relevant and open for contributions. if there are any specific guidelines or best practices you'd like me to follow.
This issue definitely is still up for grabs, with the easiest being the items in the pre-commit hooks
section.
I wouldn't recommend doing too much in a single PR: for example, if you were to add the mirrors-prettier
hook, that should be its own PR because the new hook might add other changes (making reviews harder than they need to be).
One PR per change seems totally reasonable. When finalizing this issue, those commits should also be put in the .git-blame-ignore-revs to make usage of blame easier.
FWIW the codespell is not really recommended as pre-commit hook - see discussion in #6316
edit: better formulation
Updated to only show errors.
What is your issue?
Here's the output from the Scientific Python Repo Review tool.
There's an online version here.
On mac I run
A lot of these seem fairly easy to fix. I'll note that there's a large number of
mypy
config suggestions.General
setuptools.build_meta
Projects must have a
noxfile.py
ortox.ini
to encourage new contributors.PyProject
See https://github.com/pydata/xarray/issues/8239#issuecomment-1739363809
xfail_strict
should be set. You can manually specify if a check should be strict when setting each xfail.-ra
should be inaddopts = [...]
(print summary of all fails/errors).Pre-commit
Use
https://github.com/psf/black-pre-commit-mirror
instead ofhttps://github.com/psf/black
in.pre-commit-config.yaml
Must have
https://github.com/codespell-project/codespell
repo in.pre-commit-config.yaml
Must have
https://github.com/pre-commit/pygrep-hooks
repo in.pre-commit-config.yaml
Must have
https://github.com/pre-commit/mirrors-prettier
repo in.pre-commit-config.yaml
If
--fix
is present,--show-fixes
must be too.Should have something like this in
.pre-commit-config.yaml
:MyPy
Must have
strict
in the mypy config. MyPy is best with strict or nearly strict configuration. If you are happy with the strictness of your settings already, ignore this check or setstrict = false
explicitly.Must have
warn_unreachable = true
to pass this check. There are occasionally false positives (often due to platform or Python version static checks), so it's okay to ignore this check. But try it first - it can catch real bugs too.Must have
"ignore-without-code"
inenable_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.Must have
"redundant-expr"
inenable_error_code = [...]
. This helps catch useless lines of code, like checking the same condition twice.Must have
"truthy-bool"
inenable_error_code = []
. This catches mistakes in using a value as truthy if it cannot be falsey.Ruff
Must select the flake8-bugbear
B
checks. Recommended: