-
-
Notifications
You must be signed in to change notification settings - Fork 217
Use pre-commit as a linter the CI suite #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: pip | ||
| directory: "/" | ||
| schedule: | ||
| interval: daily | ||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: daily | ||
| - package-ecosystem: pip | ||
| directory: "/" | ||
| schedule: | ||
| interval: daily | ||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: daily |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,32 +1,31 @@ | ||||||||||||||||||
| name: CI | ||||||||||||||||||
|
|
||||||||||||||||||
| on: | ||||||||||||||||||
| push: | ||||||||||||||||||
| branches: | ||||||||||||||||||
| - main | ||||||||||||||||||
| pull_request: | ||||||||||||||||||
| jobs: | ||||||||||||||||||
|
|
||||||||||||||||||
| lint: | ||||||||||||||||||
| pre-commit: | ||||||||||||||||||
| if: startsWith(github.head_ref, 'dependabot/') != true | ||||||||||||||||||
| name: pre-commit | ||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||
| strategy: | ||||||||||||||||||
| matrix: | ||||||||||||||||||
| lint-command: | ||||||||||||||||||
| - "ruff format --check --diff ." | ||||||||||||||||||
| - "ruff check --output-format=github ." | ||||||||||||||||||
| outputs: | ||||||||||||||||||
| file-names: ${{ steps.diff.outputs.file-names }} | ||||||||||||||||||
| steps: | ||||||||||||||||||
| - uses: actions/checkout@v6 | ||||||||||||||||||
| - uses: actions/setup-python@v6 | ||||||||||||||||||
| with: | ||||||||||||||||||
| python-version: "3.x" | ||||||||||||||||||
| cache: 'pip' | ||||||||||||||||||
| cache-dependency-path: '**/pyproject.toml' | ||||||||||||||||||
| - run: python -m pip install -e .[lint] | ||||||||||||||||||
| - run: ${{ matrix.lint-command }} | ||||||||||||||||||
|
|
||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||
| - run: echo "file-names=$(git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD | grep '\.py$' | tr '\n' ' ' || true)" >> "$GITHUB_OUTPUT" | ||||||||||||||||||
| id: diff | ||||||||||||||||||
|
Comment on lines
+18
to
+19
|
||||||||||||||||||
| - uses: astral-sh/setup-uv@v7 | ||||||||||||||||||
| - uses: actions/cache@v5 | ||||||||||||||||||
| with: | ||||||||||||||||||
| path: ~/.cache/pre-commit/ | ||||||||||||||||||
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | ||||||||||||||||||
|
||||||||||||||||||
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Install yq | |
| run: | | |
| YQ_VERSION=v4.44.3 | |
| wget -q "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" -O yq | |
| chmod +x yq | |
| sudo mv yq /usr/local/bin/yq |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command "uvx run pre-commit" appears to have incorrect syntax. The correct usage should be either "uvx pre-commit run" or "uv run pre-commit run" depending on whether pre-commit is installed via uvx or uv. The "uvx run" syntax is not a valid uvx command.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||
| repos: | ||||||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||||||
| rev: v6.0.0 | ||||||
| hooks: | ||||||
| - id: trailing-whitespace | ||||||
| - id: check-merge-conflict | ||||||
| - id: check-ast | ||||||
| - id: check-toml | ||||||
| - id: check-yaml | ||||||
| - id: check-symlinks | ||||||
| - id: debug-statements | ||||||
| - id: end-of-file-fixer | ||||||
| - id: no-commit-to-branch | ||||||
| args: [--branch, main] | ||||||
| - repo: https://github.com/asottile/pyupgrade | ||||||
| rev: v3.21.2 | ||||||
| hooks: | ||||||
| - id: pyupgrade | ||||||
| - repo: https://github.com/adamchainz/django-upgrade | ||||||
| rev: 1.29.1 | ||||||
|
||||||
| rev: 1.29.1 | |
| rev: v1.29.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +0,0 @@ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'file-names' output is defined but never used in any subsequent job. Consider removing the outputs section and the corresponding diff step (lines 12-13, 18-19) if this output is not needed, to simplify the workflow.