zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

Enforce Pylint rules

Open DimitriPapadopoulos opened this issue 7 months ago • 4 comments

~~Also a couple Pylint rules that may not yet be implemented in ruff.~~

Edit: Run Pylint in addition to ruff, because not all Pylint rules have been or can be implemented in ruff.

TODO:

  • [ ] Add unit tests and/or doctests in docstrings
  • [ ] Add docstrings and API docs for any new/modified user-facing classes and functions
  • [ ] New/modified features documented in docs/user-guide/*.rst
  • [ ] Changes documented as a new file in changes/
  • [x] GitHub Actions have all passed
  • [x] Test coverage is 100% (Codecov passes)

DimitriPapadopoulos avatar Jun 12 '25 22:06 DimitriPapadopoulos

I'm 👍 for spelling fixes, and 👎 for refactoring without a linter doing it automatically for us (because it just creates PR review noise for not much technical debt reduction). Could you open a PR to repalce this that just includes the spelling fixes?

dstansby avatar Jun 18 '25 20:06 dstansby

I think Sourcery applies linter rules, but rules that might not be part of ruff (yet). More importantly, I think Sourcery is a good addition - AI assistance for PR review. But I understand you don't agree with it.

Some of the Sourcery suggestions ~~do improve source code~~ are harmful, such as:

-    n_ellipsis = sum(1 for i in selection if i is Ellipsis)
+    n_ellipsis = selection.count(Ellipsis)

How about keeping the couple changes that really make sense?

DimitriPapadopoulos avatar Jun 18 '25 23:06 DimitriPapadopoulos

Codecov Report

:x: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 61.74%. Comparing base (fe42655) to head (adbf3a6).

Files with missing lines Patch % Lines
src/zarr/core/group.py 33.33% 2 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3131   +/-   ##
=======================================
  Coverage   61.74%   61.74%           
=======================================
  Files          85       85           
  Lines       10179    10175    -4     
=======================================
- Hits         6285     6283    -2     
+ Misses       3894     3892    -2     
Files with missing lines Coverage Δ
src/zarr/abc/codec.py 19.23% <ø> (ø)
src/zarr/abc/numcodec.py 15.38% <ø> (ø)
src/zarr/abc/store.py 38.29% <ø> (ø)
src/zarr/codecs/numcodecs/_codecs.py 37.88% <ø> (-0.58%) :arrow_down:
src/zarr/core/buffer/core.py 30.98% <ø> (ø)
src/zarr/core/dtype/common.py 27.71% <100.00%> (ø)
src/zarr/core/metadata/v2.py 58.13% <100.00%> (ø)
src/zarr/storage/_zip.py 72.18% <100.00%> (+0.33%) :arrow_up:
src/zarr/testing/stateful.py 98.84% <100.00%> (ø)
src/zarr/testing/store.py 75.00% <ø> (ø)
... and 1 more
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 07 '25 21:07 codecov[bot]

I have added Pylint to CI.

Adding it to pre-commit is discouraged because it is slow and incompatible with pre-commit parallelisation:

DimitriPapadopoulos avatar Oct 26 '25 09:10 DimitriPapadopoulos