Conversation
There was a problem hiding this comment.
Pull request overview
Adds a pre-commit configuration to run Ruff linting and formatting locally before commits, aligning local developer workflow with the repo’s existing Ruff setup.
Changes:
- Add
.pre-commit-config.yamlwith Ruff hooks (ruff-checkwith--fix, andruff-format). - Add
pre-committoTEKDB/requirements.txt(and normalize the existingruffentry).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
TEKDB/requirements.txt |
Adds pre-commit (and adjusts the ruff entry) so the tooling is installed via the main requirements set. |
.pre-commit-config.yaml |
Introduces pre-commit hooks to run Ruff linting (with autofix) and formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #pre-commit | ||
| pre-commit No newline at end of file |
There was a problem hiding this comment.
pre-commit is being added to TEKDB/requirements.txt, which is installed in the production Docker image and used by update/provisioning scripts. This makes a dev-only tool part of the runtime dependency set and increases image size/attack surface unnecessarily. Consider moving pre-commit (and other lint/format tooling) into a separate dev requirements file (e.g., requirements_dev.txt) or an optional extra, and keep production installs on runtime-only dependencies.
| #pre-commit | |
| pre-commit | |
| #pre-commit |
| whitenoise>=6.0.0,<7.0.0 | ||
| # FORMATTING AND LINTING | ||
| ruff No newline at end of file | ||
| ruff |
There was a problem hiding this comment.
There are now two separate sources of truth for Ruff: CI installs and runs ruff from TEKDB/requirements.txt (currently unpinned), while pre-commit will run the Ruff version pinned by the hook rev. This can lead to developers auto-fixing/formatting with one Ruff version and then failing CI with another. Consider pinning ruff to a specific version in requirements.txt (ideally matching the pre-commit rev), or switching CI to run pre-commit run --all-files so both environments use the same pinned hook versions.
| ruff | |
| ruff==0.6.9 |
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.15.5 | ||
| hooks: | ||
| - id: ruff-check | ||
| args: [ --fix ] | ||
| # Run the formatter. | ||
| - id: ruff-format No newline at end of file |
There was a problem hiding this comment.
The Ruff version used by this pre-commit hook is pinned via rev, but CI currently runs ruff check from the version installed via TEKDB/requirements.txt. If these drift, developers may get different fixes/formatting locally than what CI expects. Consider aligning the versions by pinning ruff in requirements.txt to the same version as the hook (or updating CI to run pre-commit run --all-files).
| - repo: https://github.com/astral-sh/ruff-pre-commit | |
| rev: v0.15.5 | |
| hooks: | |
| - id: ruff-check | |
| args: [ --fix ] | |
| # Run the formatter. | |
| - id: ruff-format | |
| - repo: local | |
| hooks: | |
| - id: ruff-check | |
| name: ruff-check | |
| entry: ruff | |
| language: system | |
| types: [python] | |
| args: [ --fix ] | |
| # Run the formatter. | |
| - id: ruff-format | |
| name: ruff-format | |
| entry: ruff | |
| language: system | |
| types: [python] | |
| args: [ format ] |
adds a pre-commit hook to run
ruff checkandruff format