-
Notifications
You must be signed in to change notification settings - Fork 54
pre-commit setup #238
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
Merged
Merged
pre-commit setup #238
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ca2d089
Add pyupgrade to pre-commit config
ulgens 404eb50
Apply pyupgrade's "yield => yield from" fix
ulgens db7dab1
Apply pyupgrade's "super() calls" fix
ulgens 7212f43
Add django-upgrade to pre-commit config
ulgens 1b98b56
Add pre-commit-hooks to pre-commit config
ulgens 2927f83
Enable "check-shebang-scripts-are-executable" pre-commit hook and app…
ulgens 88229cf
Enable "end-of-file-fixer" pre-commit hook and apply fixes
ulgens a959f71
Enable "fix-byte-order-marker" pre-commit hook and apply fixes
ulgens aa39d56
Enable "trailing-whitespace" pre-commit hook and apply fixes
ulgens 797b362
Add black to pre-commit config and apply fixes
ulgens 023aad0
Don't exclude migrations from black
ulgens 4ae78d6
Add prettier to pre-commit config, and .editorconfig
ulgens eaa9cfe
Apply prettier fixes
ulgens ab46da9
Add pyproject-fmt to pre-commit hooks
ulgens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# http://editorconfig.org | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.py] | ||
max_line_length = 88 | ||
|
||
[*.{html,json}] | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = false | ||
|
||
[*.{scss,js}] | ||
indent_style = space | ||
indent_size = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
push: | ||
branches: ["main"] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=true | ||
tags: | | ||
type=ref,event=branch | ||
type=sha | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=true | ||
tags: | | ||
type=ref,event=branch | ||
type=sha | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
name: Docker test build | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
contents: read | ||
|
||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
build-image: | ||
runs-on: ubuntu-latest | ||
|
||
# steps taken (and trimmed) from docker-publish.yml | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
# steps taken (and trimmed) from docker-publish.yml | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: false | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
name: Linters | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
contents: read | ||
|
||
jobs: | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: black | ||
uses: psf/black@stable | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: black | ||
uses: psf/black@stable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,70 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
contents: read | ||
|
||
env: | ||
DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests | ||
# passlib has a conditional import for `crypt` which is going away in python 3.13 | ||
# and therefore throwing warnings | ||
PYTHONWARNINGS: > | ||
error, | ||
default:::passlib.utils, | ||
DJANGO_SETTINGS_MODULE: tracdjangoplugin.settings_tests | ||
# passlib has a conditional import for `crypt` which is going away in python 3.13 | ||
# and therefore throwing warnings | ||
PYTHONWARNINGS: > | ||
error, | ||
default:::passlib.utils, | ||
|
||
jobs: | ||
noshadows: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- run: pip install "tinycss2>=1.2.0" | ||
- run: python noshadows.py --tests | ||
noshadows: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- run: pip install "tinycss2>=1.2.0" | ||
- run: python noshadows.py --tests | ||
|
||
tracdjangoplugin: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install system package dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get -y install subversion | ||
- name: Install requirements | ||
run: python -m pip install -r requirements.txt | ||
- name: Run tests | ||
run: python -m django test tracdjangoplugin.tests | ||
tracdjangoplugin: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install system package dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get -y install subversion | ||
- name: Install requirements | ||
run: python -m pip install -r requirements.txt | ||
- name: Run tests | ||
run: python -m django test tracdjangoplugin.tests | ||
|
||
traccheck: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install system package dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get -y install subversion | ||
- name: Install requirements | ||
run: python -m pip install -r requirements.txt | ||
- name: Lint Trac configuration | ||
run: python traccheck.py lint trac-env/ | ||
- name: Check frozen Trac components | ||
run: python traccheck.py components --check .TRACFREEZE.txt trac-env/ | ||
traccheck: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install system package dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get -y install subversion | ||
- name: Install requirements | ||
run: python -m pip install -r requirements.txt | ||
- name: Lint Trac configuration | ||
run: python traccheck.py lint trac-env/ | ||
- name: Check frozen Trac components | ||
run: python traccheck.py components --check .TRACFREEZE.txt trac-env/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
default_language_version: | ||
python: python3 | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: "v5.0.0" | ||
hooks: | ||
- id: check-added-large-files | ||
args: ["--maxkb=1024"] | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-toml | ||
- id: check-yaml | ||
args: ["--allow-multiple-documents"] | ||
- id: debug-statements | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
exclude_types: [json, sql] | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: "v3.19.0" | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py312] | ||
|
||
- repo: https://github.com/adamchainz/django-upgrade | ||
rev: "1.22.2" | ||
hooks: | ||
- id: django-upgrade | ||
args: [--target-version, "5.0"] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.10.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/rbubley/mirrors-prettier | ||
rev: "v3.4.2" | ||
hooks: | ||
- id: prettier | ||
exclude_types: [html, css, javascript, json, scss] | ||
|
||
- repo: https://github.com/tox-dev/pyproject-fmt | ||
rev: "v2.5.0" | ||
hooks: | ||
- id: pyproject-fmt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.