Skip to content

Commit

Permalink
Add prettier to pre-commit (#3268)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Jan 2, 2024
1 parent 5facd6f commit 3a3058a
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 62 deletions.
24 changes: 12 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "Codespell Development Environment",
"image": "mcr.microsoft.com/devcontainers/python:1-3",
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"postCreateCommand": "bash .devcontainer/post_create.sh"
"name": "Codespell Development Environment",
"image": "mcr.microsoft.com/devcontainers/python:1-3",
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"postCreateCommand": "bash .devcontainer/post_create.sh"
}
17 changes: 8 additions & 9 deletions .github/workflows/codespell-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
fail-fast: false
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
no-toml:
- ''
- ""
include:
- python-version: '3.10'
no-toml: 'no-toml'
- python-version: "3.10"
no-toml: "no-toml"
name: ${{ matrix.python-version }} ${{ matrix.no-toml }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -58,7 +58,6 @@ jobs:
# this file has an error
- run: "! codespell codespell_lib/tests/test_basic.py"


make-check-dictionaries:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codespell-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: "3.8"
- name: Install dependencies
run: |
python --version
Expand Down
62 changes: 31 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,41 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*
- name: Check env vars
run: |
echo "Triggered by: ${{ github.event_name }}"
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*
- name: Check env vars
run: |
echo "Triggered by: ${{ github.event_name }}"
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist

# PyPI on release
pypi:
needs: package
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ repos:
hooks:
- id: mdformat
name: Format Markdown
entry: mdformat # Executable to run, with fixed options
entry: mdformat # Executable to run, with fixed options
language: python
types: [markdown]
args: [--wrap, '75', --number]
args: [--wrap, "75", --number]
additional_dependencies:
- mdformat-toc
- mdformat-beautysh
Expand Down Expand Up @@ -56,12 +56,17 @@ repos:
args:
- --no-warnings
- -d
- '{extends: relaxed, rules: {line-length: {max: 90}}}'
- "{extends: relaxed, rules: {line-length: {max: 90}}}"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- id: codespell
name: codespell
description: Checks for common misspellings in text files.
entry: codespell
language: python
types: [text]
- id: codespell
name: codespell
description: Checks for common misspellings in text files.
entry: codespell
language: python
types: [text]

0 comments on commit 3a3058a

Please sign in to comment.