Skip to content

Conversation

@jensens
Copy link
Member

@jensens jensens commented Oct 22, 2025

Summary

This PR modernizes the pre-commit configuration by replacing black with ruff for linting and formatting, while keeping isort for import sorting with the plone profile.

Changes

Pre-commit Configuration:

  • Replace black with ruff for both linting and formatting
  • Configure ruff with:
    • line-length = 120
    • target-version = "py310"
    • Enable rules: E, W, F, UP, D
    • Ignore docstring rules: D100-D107, D202, D205, D301, D400, D401, D415
    • Ignore F841 (unused variables) in tests directory
  • Keep isort with plone profile and force-alphabetical-sort configuration
  • Add setuptools as additional dependency for isort (Python 3.13 compatibility)

Code Quality Fixes:

  • Fix undefined s() function in svn.py → use stderr.decode()
  • Fix undefined b() function in test_mercurial.py → use b":" literal

Configuration Updates:

  • Update pyproject.toml with ruff and isort configurations
  • Update .pre-commit-config.yaml with new hooks
  • Makefile auto-updated by mxmake (qa.black → qa.ruff)

Code Formatting:

  • Applied ruff-format to all files
  • Applied isort with plone profile to all files

Benefits

  • Faster: Ruff is 10-100x faster than black + flake8
  • Modern: Better Python 3.10+ support
  • Consistent: Same code style, just faster tooling
  • CI Speed: Faster pre-commit and CI runs

Testing

  • ✅ All 174 tests pass
  • ✅ All pre-commit hooks pass
  • ✅ No functional changes to code logic

Related

This builds on PR #63 (Python 3.10+ migration).

…rofile

- Replace black with ruff for linting and formatting
- Keep isort for import sorting with plone profile and alphabetical rules
- Configure ruff with line-length=120, target Python 3.10+
- Add ruff configuration with appropriate rule selections and ignores
- Ignore F841 (unused variables) in tests directory
- Fix compatibility issues:
  - Fix undefined s() function in svn.py (use stderr.decode())
  - Fix undefined b() function in test_mercurial.py (use b":" literal)
- Update pyproject.toml with ruff and isort configurations
- Update Makefile (mxmake auto-updated qa.black -> qa.ruff)
- Apply ruff-format and isort to all files

This modernizes the tooling stack while keeping the project's code style
consistent. Ruff provides faster linting/formatting and better Python 3.10+
support.
- Replace black/flake8 references with ruff
- Add ruff linting and formatting commands
- Update Code Style section with ruff formatter details
- Document isort with plone profile configuration
- Add Python 3.10+ type hint syntax examples
@jensens jensens merged commit 06abdb5 into main Oct 22, 2025
17 checks passed
@jensens jensens deleted the feature/modernize-precommit-ruff branch October 22, 2025 16:00
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