Skip to content

Commit d1c4503

Browse files
committed
Enable prettier (and ruff) in pre-commit
1 parent d4af081 commit d1c4503

File tree

3 files changed

+86
-77
lines changed

3 files changed

+86
-77
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ on:
77
types: [published]
88
schedule:
99
# Daily at 3:21
10-
- cron: '21 3 * * *'
10+
- cron: "21 3 * * *"
1111

1212
jobs:
1313
pre-commit:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-python@v4
18-
with:
19-
python-version: "3.11"
20-
- uses: pre-commit/[email protected]
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.11"
20+
- uses: pre-commit/[email protected]
2121

2222
ci:
2323
runs-on: ${{ matrix.os }}
@@ -152,59 +152,59 @@ jobs:
152152
toxenv: docs-style
153153

154154
steps:
155-
- uses: actions/checkout@v3
156-
- name: Set up Python ${{ matrix.python-version.name }}
157-
uses: actions/setup-python@v4
158-
with:
159-
python-version: ${{ matrix.python-version.name }}
160-
- name: Install dependencies
161-
run: >
162-
sudo apt-get update &&
163-
sudo apt-get install -y libenchant-2-dev libxml2-dev libxslt-dev
164-
if: runner.os == 'Linux' && startsWith(matrix.python-version.toxenv, 'docs-')
165-
- name: Install dependencies
166-
run: brew install enchant
167-
if: runner.os == 'macOS' && startsWith(matrix.python-version.toxenv, 'docs-')
168-
- name: Install tox
169-
run: python -m pip install tox
170-
- name: Enable UTF-8 on Windows
171-
run: echo "PYTHONUTF8=1" >> $env:GITHUB_ENV
172-
if: runner.os == 'Windows' && startsWith(matrix.python-version.toxenv, 'py')
173-
- name: Run tox
174-
run: python -m tox -e "${{ matrix.python-version.toxenv }}"
155+
- uses: actions/checkout@v3
156+
- name: Set up Python ${{ matrix.python-version.name }}
157+
uses: actions/setup-python@v4
158+
with:
159+
python-version: ${{ matrix.python-version.name }}
160+
- name: Install dependencies
161+
run: >
162+
sudo apt-get update &&
163+
sudo apt-get install -y libenchant-2-dev libxml2-dev libxslt-dev
164+
if: runner.os == 'Linux' && startsWith(matrix.python-version.toxenv, 'docs-')
165+
- name: Install dependencies
166+
run: brew install enchant
167+
if: runner.os == 'macOS' && startsWith(matrix.python-version.toxenv, 'docs-')
168+
- name: Install tox
169+
run: python -m pip install tox
170+
- name: Enable UTF-8 on Windows
171+
run: echo "PYTHONUTF8=1" >> $env:GITHUB_ENV
172+
if: runner.os == 'Windows' && startsWith(matrix.python-version.toxenv, 'py')
173+
- name: Run tox
174+
run: python -m tox -e "${{ matrix.python-version.toxenv }}"
175175

176176
packaging:
177177
needs: ci
178178
runs-on: ubuntu-latest
179179

180180
steps:
181-
- uses: actions/checkout@v3
182-
with:
183-
fetch-depth: 0
184-
- uses: actions/setup-python@v4
185-
with:
186-
python-version: "3.10"
187-
- name: Install dependencies
188-
run: python -m pip install build
189-
- name: Create packages
190-
run: python -m build .
191-
- uses: actions/upload-artifact@v3
192-
with:
193-
name: dist
194-
path: dist
195-
- name: Publish package
196-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
197-
uses: pypa/gh-action-pypi-publish@release/v1
198-
with:
199-
user: __token__
200-
password: ${{ secrets.pypi_password }}
201-
- name: Create Release Notes
202-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
203-
uses: actions/github-script@v6
204-
with:
205-
github-token: ${{ secrets.GITHUB_TOKEN }}
206-
script: |
207-
await github.request(`POST /repos/${{ github.repository }}/releases`, {
208-
tag_name: "${{ github.ref }}",
209-
generate_release_notes: true
210-
});
181+
- uses: actions/checkout@v3
182+
with:
183+
fetch-depth: 0
184+
- uses: actions/setup-python@v4
185+
with:
186+
python-version: "3.10"
187+
- name: Install dependencies
188+
run: python -m pip install build
189+
- name: Create packages
190+
run: python -m build .
191+
- uses: actions/upload-artifact@v3
192+
with:
193+
name: dist
194+
path: dist
195+
- name: Publish package
196+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
197+
uses: pypa/gh-action-pypi-publish@release/v1
198+
with:
199+
user: __token__
200+
password: ${{ secrets.pypi_password }}
201+
- name: Create Release Notes
202+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
203+
uses: actions/github-script@v6
204+
with:
205+
github-token: ${{ secrets.GITHUB_TOKEN }}
206+
script: |
207+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
208+
tag_name: "${{ github.ref }}",
209+
generate_release_notes: true
210+
});

.github/workflows/fuzz.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ jobs:
99
Fuzzing:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Build Fuzzers
13-
id: build
14-
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
15-
with:
16-
oss-fuzz-project-name: 'jsonschema'
17-
language: python
18-
continue-on-error: true
19-
- name: Run Fuzzers
20-
if: steps.build.outcome == 'success'
21-
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
22-
with:
23-
oss-fuzz-project-name: 'jsonschema'
24-
fuzz-seconds: 30
25-
- name: Upload Crash
26-
uses: actions/upload-artifact@v3
27-
if: failure() && steps.build.outcome == 'success'
28-
with:
29-
name: artifacts
30-
path: ./out/artifacts
12+
- name: Build Fuzzers
13+
id: build
14+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
15+
with:
16+
oss-fuzz-project-name: "jsonschema"
17+
language: python
18+
continue-on-error: true
19+
- name: Run Fuzzers
20+
if: steps.build.outcome == 'success'
21+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
22+
with:
23+
oss-fuzz-project-name: "jsonschema"
24+
fuzz-seconds: 30
25+
- name: Upload Crash
26+
uses: actions/upload-artifact@v3
27+
if: failure() && steps.build.outcome == 'success'
28+
with:
29+
name: artifacts
30+
path: ./out/artifacts

.pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@ repos:
1010
- id: check-vcs-permalinks
1111
- id: check-yaml
1212
- id: debug-statements
13-
exclude: '^jsonschema/tests/_suite.py$'
13+
exclude: "^jsonschema/tests/_suite.py$"
1414
- id: end-of-file-fixer
1515
- id: mixed-line-ending
1616
args: [--fix, lf]
1717
- id: trailing-whitespace
18+
- repo: https://github.com/charliermarsh/ruff-pre-commit
19+
rev: "v0.0.269"
20+
hooks:
21+
- id: ruff
1822
- repo: https://github.com/PyCQA/isort
1923
rev: 5.12.0
2024
hooks:
21-
- id: isort
25+
- id: isort
26+
- repo: https://github.com/pre-commit/mirrors-prettier
27+
rev: "v3.0.0-alpha.9-for-vscode"
28+
hooks:
29+
- id: prettier
30+
exclude: "^jsonschema/benchmarks/issue232/issue.json$"

0 commit comments

Comments
 (0)