Skip to content

style: satisfy docstring and complexity gates in the sync script - #57

Merged
saudzahirr merged 1 commit into
masterfrom
chore/lint-sync-script
Aug 18, 2026
Merged

style: satisfy docstring and complexity gates in the sync script#57
saudzahirr merged 1 commit into
masterfrom
chore/lint-sync-script

Conversation

@saudzahirr

Copy link
Copy Markdown
Collaborator

The code quality gate flags 45 issues in .github/scripts/sync_python_versions.py, all introduced with that script. This fixes them; behaviour is unchanged.

Docstrings (44 issues). The gate runs pydocstyle with no convention selected, so it wants NumPy sections — dashed underlines (D407), section names without a trailing colon (D406), a summary starting on the second line (D213) and a blank line closing the last section (D413). Ruff's DOC rules accepted the Google-style Args:/Returns: form, so this was invisible to the CI lint job. Every docstring is now NumPy style, which both gates accept.

Complexity (1 issue). main() was at cyclomatic complexity 16 against a limit of 15. Split into load_project() (file reading), resolve() (floor arithmetic) and changes() (the bullet list describe() built inline); main() is now 7, and the file's worst function is 13.

Also replaces typing.Any with the real tomlkit types, which ANN401 disallows, using Floors/Resolved aliases to keep signatures inside 80 columns — sdepack sets no line-length and so formats at 88, and a signature wrapped for 80 is rejoined at 88, which would leave the two formatters permanently disagreeing.

Verified: pydocstyle clean, ruff lint and format --check clean against all 13 repo configs, max complexity 13, and the full behaviour battery re-run (no-op when in sync, Python 4/5 major-line replacement, floor never lowered, quote style preserved, valid TOML).

🤖 Generated with Claude Code

The code quality gate runs pydocstyle with no convention selected, so the
Google-style "Args:"/"Returns:" sections ruff accepted are rejected there:
it wants NumPy sections with dashed underlines (D406/D407), a summary
starting on the second line (D213) and a blank line closing the last
section (D413).

Converts every docstring to NumPy style, which both gates accept, and
splits main() so its cyclomatic complexity drops from 16 to 7 -- the gate
caps it at 15. load_project() and resolve() now own the file reading and
the floor arithmetic, and changes() owns the bullet list that describe()
used to build inline.

Also drops typing.Any for the real tomlkit types, which ANN401 disallows,
and introduces the Floors and Resolved aliases so the signatures stay
inside 80 columns. That last point matters: sdepack sets no line-length so
it formats at 88, and a signature wrapped for 80 gets rejoined at 88, so
the two formatters would disagree forever.

Behaviour is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@saudzahirr
saudzahirr merged commit 05268a7 into master Aug 18, 2026
8 checks passed
@saudzahirr
saudzahirr deleted the chore/lint-sync-script branch August 18, 2026 11:10
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants