Skip to content

Format code and configure ruff linting for scripts directory#5428

Open
ludeeus wants to merge 1 commit into
mainfrom
claude/ruff-lint-format-scripts-hselpi
Open

Format code and configure ruff linting for scripts directory#5428
ludeeus wants to merge 1 commit into
mainfrom
claude/ruff-lint-format-scripts-hselpi

Conversation

@ludeeus

@ludeeus ludeeus commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

This PR applies code formatting improvements and updates the ruff linting configuration to properly handle the scripts/ directory with appropriate rule exceptions.

Key Changes

  • Code Formatting: Applied consistent line length formatting throughout scripts/data/generate_category_data.py and scripts/data/validate_category_py, collapsing multi-line statements where appropriate to improve readability
  • Ruff Configuration: Added per-file-ignores configuration in pyproject.toml to exclude specific linting rules for scripts (T201, PTH118, PTH109, ASYNC230, DTZ003) that are acceptable in CLI/dev utility scripts
  • Pre-commit Configuration: Updated .github/pre-commit-config.yaml to include scripts/ directory in ruff check and format file patterns (changed script to scripts)
  • Module Docstrings: Added blank lines after module docstrings in scripts/data/common.py, scripts/data/validate_category_data.py, scripts/update/default_repositories.py, and scripts/update/manifest.py for PEP 257 compliance

Notable Details

  • The formatting changes maintain functional equivalence while improving code consistency
  • The ruff configuration exceptions are appropriate for utility scripts that may use print() statements, os.path operations, and blocking I/O
  • All changes align with the project's existing code style and linting standards

https://claude.ai/code/session_01YYn1cR8ELdBU4Ko4c4WsSd

The ruff-check and ruff-format pre-commit hooks filtered files with a regex
that referenced "script" (singular) instead of "scripts", so nothing under
scripts/ was ever linted or formatted by the hooks. This let formatting drift
accumulate.

- Reformat the 5 drifted files under scripts/ with ruff format.
- Fix the files regex in both ruff hooks (script -> scripts) so the directory
  is covered going forward.
- Add per-file-ignores for scripts/** (T201, PTH118, PTH109, ASYNC230, DTZ003)
  so the newly-covered ruff check passes without changing script behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YYn1cR8ELdBU4Ko4c4WsSd
Copilot AI review requested due to automatic review settings July 24, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes formatting in the scripts/ Python utilities and updates linting configuration so the repo’s Ruff hooks correctly include scripts/ while allowing a small, documented set of CLI-script-appropriate exceptions.

Changes:

  • Added PEP 257-compliant spacing after module docstrings in several scripts/ modules.
  • Applied Ruff formatting to collapse/normalize multi-line statements in the data generation/validation scripts.
  • Updated linting configuration: pyproject.toml adds Ruff per-file ignores for scripts/**, and pre-commit patterns now target scripts/ (plural) instead of script/.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/update/manifest.py Adds a blank line after the module docstring for PEP 257 compliance.
scripts/update/default_repositories.py Adds a blank line after the module docstring for PEP 257 compliance.
scripts/data/validate_category_data.py Formatting-only changes to simplify wrapped calls and strings.
scripts/data/generate_category_data.py Ruff-formatting across several statements/log calls without behavioral changes.
scripts/data/common.py Adds a blank line after the module docstring for PEP 257 compliance.
pyproject.toml Adds Ruff per-file-ignores for scripts/** to permit CLI-utility patterns.
.github/pre-commit-config.yaml Updates Ruff hook file globs to include scripts/ (plural) consistently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ludeeus
ludeeus marked this pull request as ready for review July 24, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants