style: clear the harmless Ruff findings - #287
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces the Ruff baseline by addressing remaining low-risk lint findings through docstring formatting tweaks, clearer # noqa annotations, and a small exception-handling improvement to avoid swallowing KeyboardInterrupt.
Changes:
- Convert several docstrings to a summary-line + body format (D205) and document
**additional_optionsonConfigFile.add_profile(D417). - Replace blanket
# noqacomments with explicit rule codes and switch two bareexcept:clauses toexcept Exception. - Small style/lint cleanups: replace an en dash with a hyphen in help text (RUF001) and rename Sphinx config
copyrighttoproject_copyright(A001).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/update_chapter_titles.py | Docstring reformatted to satisfy D205. |
| src/audible_cli/utils.py | Replaces blanket # noqa with specific codes; changes bare except: to except Exception in downloader post-processing. |
| src/audible_cli/plugins.py | Docstring summary/body split for D205 compliance. |
| src/audible_cli/models.py | Docstring summary/body split for D205 compliance. |
| src/audible_cli/decorators.py | Docstring formatting + help-text punctuation change (RUF001). |
| src/audible_cli/config.py | Documents **additional_options parameter in add_profile docstring (D417). |
| src/audible_cli/cmds/init.py | Docstring summary/body adjustment for D205 compliance. |
| src/audible_cli/_logging.py | Docstring summary/body split for D205 compliance. |
| pyproject.toml | Updates Ruff per-file-ignores baseline entries to reflect reduced findings. |
| plugin_cmds/convert_oa_cred.py | Docstring reformatted to satisfy D205. |
| docs/source/conf.py | Renames copyright to project_copyright to avoid A001. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
mkb79
force-pushed
the
style/lint-cleanup
branch
from
August 9, 2026 08:15
0f4256a to
a2b843a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (2)
utils/update_chapter_titles.py:1
- Docstring grammar: use “an” before “ffmetadata” (pronounced “eff”).
"""Replace the chapter titles of a ffmetadata file.
src/audible_cli/_logging.py:142
- Docstring sentence “That is …” reads ungrammatically here; rephrase to clearly refer to the handler and formatter.
That is :py:class:`ClickHandler` and :py:class:`ColorFormatter`.
Takes the baseline from 42 findings to 26, leaving only the ones that need a real code change: the download orchestration (C901, PLW0603, PLW2901, ASYNC240), the error contracts (B904, S101) and PLR0917. - PGH004: three blanket `# noqa` comments. The one on `import readline` was hiding two rules, F401 and PLC0415, and is now spelled out. The two in `Downloader._postpare` sat on bare `except:` clauses, which also swallow KeyboardInterrupt while reading the error message off a failed download; they now catch Exception. `except OSError` would be too narrow, the temp file holds a partial response body and read_text() can just as well raise UnicodeDecodeError. - D205: ten docstrings split into a summary line and a body. Two of them, `LibraryItem._get_codec` and `BrokenCommand`, gained a summary line above their existing text; the rest were reworded around the split, mostly into the imperative mood the Google convention asks for. Where that rewording would have dropped the fact that the function is a decorator, the summary says so again. - D417: documented `**additional_options` on `ConfigFile.add_profile`. - RUF001: an en dash in the `--page-size` help text is now a hyphen. - A001: `docs/source/conf.py` sets the copyright through Sphinx' own `project_copyright` alias, which has been supported since Sphinx 3.5, rather than shadowing the builtin. - A002 needs no entry any more, #286 renamed that parameter. Two typos in docstrings this touches anyway, "them codecs list" and "build-in", are corrected. The `build_in_cmds` function keeps its name and so do the two occurrences in plugin_cmds/README.md; a rename is not a lint fix.
mkb79
force-pushed
the
style/lint-cleanup
branch
from
August 9, 2026 09:21
a2b843a to
e99c586
Compare
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.
Works off the Ruff baseline from #281, taking it from 42 findings to 26. Everything in here is a lint fix; what is left in the baseline needs a real code change.
PGH004×3# noqacomments spelled out or removedD205×10D417**additional_optionsdocumented onConfigFile.add_profileRUF001--page-sizehelp text is now a hyphenA001docs/source/conf.pyuses Sphinx'project_copyrightaliasA002The one behaviour change
Two of the three
PGH004findings sat on bareexcept:clauses inDownloader._postpare, which read the error message off a failed download. A bareexcept:also swallowsKeyboardInterrupt, so they now catchException.except OSErrorwould be too narrow: the temp file holds a partial response body, soread_text()can just as well raiseUnicodeDecodeError.That class is still live —
cmd_downloaduses it for covers and PDFs.On
A001This one looked like a permanent exception rather than debt, since
docs/source/conf.pyhas to set the copyright. It is not: Sphinx has acceptedproject_copyrightas an alias since 3.5, so the variable is simply renamed and the entry is gone. The repo pins no Sphinx version and carries no.readthedocs.yaml, so the docs build against a current release, and nothing else underdocs/refers to the old name.Docstrings
LibraryItem._get_codecandBrokenCommandgained a summary line above their existing text. The rest were reworded around the split, mostly into the imperative mood the Google convention asks for. Where that rewording would have dropped the fact that the function is a decorator, the summary says so again.Two typos Copilot spotted in docstrings this touches anyway, "them codecs list" and "build-in", are corrected. The
build_in_cmdsfunction keeps its name and so do the two occurrences inplugin_cmds/README.md; a rename is not a lint fix.What is left
The remaining 26 findings, in the order they are worth tackling: the error and input contracts (
B904,S101), the download orchestration (C901,PLW0603,PLW2901,ASYNC240) and finallyPLR0917.Verification
ruff check,ruff format --checkand the 56 tests pass. The 42 → 26 count was measured by emptying the baseline block on bothmasterand this branch and counting the findings it suppresses. No changelog entry, matching #282, #283 and #285.