Repository navigation
Harmonise formatting: ruff 0.7.4, pyright 1.1.411, line length 88 - #53
Merged
Merged
Conversation
gertils locked ruff 0.3.7, as its constraint allowed any ruff from 0.3, and pyright 1.1.414. looptrace and spotfishing pin ruff 0.7.4 and pyright 1.1.411, so that the repositories behind looptrace are formatted, linted and type-checked by the same versions. gertils now pins the same versions. Neither version changes any result: all checks pass without changes to the code. Refs #52
gertils set a line length of 100, while the other repositories behind looptrace use the default of 88 of both ruff and black. The setting is removed, and ruff formats the code at 88. One `# noqa: D103` comment goes back on the line of its function's name, where ruff reports the missing docstring, after the formatter split the function's signature. Strings, comments and docstrings that ruff doesn't wrap stay longer; the configuration doesn't check line length (E501). Closes #52
numpydoc_decorator's @doc writes a function's docstring when the module is imported, so ruff, which only reads the source, reported each decorated function as undocumented, and each needed a `# noqa: D103` comment. ruff's pydocstyle setting ignore-decorators now skips the functions decorated with @doc, and the six comments are removed. ruff still reports a public function that has neither a docstring nor @doc. The setting doesn't apply to classes, so their `# noqa: D101` comments stay.
There was a problem hiding this comment.
🟢 Approval recommended
The tooling updates are consistent, formatting preserves behavior, and no blocking issues were identified.
No open issues 🎉
What changed in this PR
Aligns gertils with the shared formatting and type-checking standards in #52, without changing runtime behavior.
Changes:
- Pins Ruff 0.7.4 and Pyright 1.1.411.
- Adopts Ruff’s default 88-character formatting.
- Replaces function-level docstring suppressions with decorator-aware configuration.
| File | Description |
|---|---|
typings/zarr/__init__.pyi |
Reformats a stub signature. |
tests/test_pixel_value_statistics.py |
Reformats statistics tests. |
tests/test_pathtools.py |
Reformats path tests. |
tests/test_get_fov_sort_key.py |
Reformats imports and tests. |
pyproject.toml |
Pins tools and updates Ruff settings. |
poetry.lock |
Locks the selected tool versions. |
gertils/zarr_tools.py |
Reformats code and removes a docstring suppression. |
gertils/types.py |
Reformats exception construction. |
gertils/pixel_value_statistics.py |
Reformats code and removes docstring suppressions. |
gertils/pathtools.py |
Reformats code and removes docstring suppressions. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings gertils in line with the other repositories behind looptrace, as #52 describes. gertils already formats with
ruff format, lints withruff checkand type-checks with pyright, in the pre-commit hooks and in CI, and installs neither black, isort, pylint nor mypy. What remained were the versions and the line length, in the first two commits. The third removes# noqacomments that the reformatting showed to be fragile:line-length = 100, so that ruff formats at its default of 88, and reformats the code: 8 of 15 files, 114 lines added and 42 removed.@docgives functions their docstrings, with pydocstyle'signore-decoratorssetting, so that the six# noqa: D103comments on decorated functions go. When the formatter split a signature, it moved one of them off the line where ruff reports the rule. Classes keep their# noqa: D101, as the setting applies only to functions.Nothing changes for users of gertils, so this needs no release: besides the layout, the code changes only in its
# noqacomments.Testing
pyright --verifytypes gertilsstill finds 100% of the public API typed.ignore-decorators, ruff still reports a public function that has neither a docstring nor@doc.Merging
Please don't squash:
maincan be fast-forwarded to the branch, which keeps the three commits as they are.Closes #52