Skip to content

Enforce Pylint rules#3131

Open
DimitriPapadopoulos wants to merge 16 commits into
zarr-developers:mainfrom
DimitriPapadopoulos:sourcery
Open

Enforce Pylint rules#3131
DimitriPapadopoulos wants to merge 16 commits into
zarr-developers:mainfrom
DimitriPapadopoulos:sourcery

Conversation

@DimitriPapadopoulos

@DimitriPapadopoulos DimitriPapadopoulos commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

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/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions Bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 12, 2025
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as draft June 12, 2025 22:14
@dstansby

Copy link
Copy Markdown
Contributor

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?

@DimitriPapadopoulos

DimitriPapadopoulos commented Jun 18, 2025

Copy link
Copy Markdown
Contributor Author

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 DimitriPapadopoulos force-pushed the sourcery branch 12 times, most recently from bec6be5 to 7270dd1 Compare June 26, 2025 20:10
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the sourcery branch 3 times, most recently from f55e79a to 5a1df20 Compare July 7, 2025 21:10
@codecov

codecov Bot commented Jul 7, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.51%. Comparing base (5236a03) to head (aa2ed50).

Files with missing lines Patch % Lines
src/zarr/core/group.py 33.33% 2 Missing ⚠️
src/zarr/testing/stateful.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3131      +/-   ##
==========================================
- Coverage   93.54%   93.51%   -0.03%     
==========================================
  Files          90       90              
  Lines       11936    11926      -10     
==========================================
- Hits        11165    11153      -12     
- Misses        771      773       +2     
Files with missing lines Coverage Δ
src/zarr/abc/codec.py 98.76% <ø> (ø)
src/zarr/abc/numcodec.py 100.00% <ø> (ø)
src/zarr/abc/store.py 96.17% <ø> (ø)
src/zarr/codecs/cast_value.py 98.60% <100.00%> (ø)
src/zarr/codecs/numcodecs/_codecs.py 96.20% <ø> (-0.19%) ⬇️
src/zarr/core/buffer/core.py 82.63% <ø> (-0.12%) ⬇️
src/zarr/core/buffer/cpu.py 100.00% <ø> (ø)
src/zarr/core/chunk_grids.py 96.94% <ø> (ø)
src/zarr/core/dtype/common.py 86.04% <100.00%> (-0.17%) ⬇️
src/zarr/core/metadata/v2.py 89.44% <100.00%> (ø)
... and 6 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DimitriPapadopoulos DimitriPapadopoulos force-pushed the sourcery branch 2 times, most recently from 58a885b to ae772b5 Compare July 12, 2025 11:08
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review July 12, 2025 11:09
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the sourcery branch 2 times, most recently from 679e33e to 6c9c486 Compare August 6, 2025 07:09
@DimitriPapadopoulos DimitriPapadopoulos changed the title Apply Sourcery suggestions and fix typos Apply more ruff rules Aug 6, 2025
@DimitriPapadopoulos DimitriPapadopoulos changed the title Apply more ruff rules Apply ruff preview rule Aug 6, 2025
Disable rules that:
- we don't want to fix,
- have been implemenetd in ruff,
- could be enabled later and are currently followed by `FIXME`.
FURB140 Use `itertools.starmap` instead of the generator
Unnecessary ellipsis constant
Attribute '_is_open' defined outside __init__
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the sourcery branch 3 times, most recently from 4f8ab1b to a5810fa Compare July 5, 2026 10:36
Useless parent or super() delegation in method '__init__'
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the sourcery branch 5 times, most recently from 1ab793d to 1e4bc11 Compare July 5, 2026 11:38
Unnecessary parens after 'not' keyword
Unnecessary parens after ':=' keyword
Do not raise StopIteration in generator, use return statement instead
Unnecessary use of a comprehension
Simplify chained comparison between the operands
__init__ method from base class is not called
Unnecessarily calls dunder method __init__. Instantiate class directly.
@DimitriPapadopoulos DimitriPapadopoulos force-pushed the sourcery branch 2 times, most recently from 84b74a3 to c019f41 Compare July 5, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants