Skip to content

Commit

Permalink
Add prettier check to format non-python code (#144)
Browse files Browse the repository at this point in the history
* Add prettier check to format non-python code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tkoyama010 and pre-commit-ci[bot] authored Nov 4, 2024
1 parent 9ebda36 commit aea09d3
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 121 deletions.
42 changes: 21 additions & 21 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
documentation:
- any:
- changed-files:
- any-glob-to-any-file: 'doc/**/*'
- any-glob-to-any-file: 'examples/**/*'
- any-glob-to-any-file: './*.md'
- any-glob-to-any-file: './*.rst'
- any:
- changed-files:
- any-glob-to-any-file: "doc/**/*"
- any-glob-to-any-file: "examples/**/*"
- any-glob-to-any-file: "./*.md"
- any-glob-to-any-file: "./*.rst"
maintenance:
- any:
- changed-files:
- any-glob-to-any-file: '.github/**/*'
- any-glob-to-any-file: 'codecov.yml'
- any-glob-to-any-file: '.flake8'
- any-glob-to-any-file: '.coveragerc'
- any-glob-to-any-file: '.codecimate.yml'
- any-glob-to-any-file: 'ignore_words.txt'
- any-glob-to-any-file: 'mypy.ini'
- any-glob-to-any-file: 'pyproject.toml'
- any-glob-to-any-file: 'setup.py'
- any:
- changed-files:
- any-glob-to-any-file: ".github/**/*"
- any-glob-to-any-file: "codecov.yml"
- any-glob-to-any-file: ".flake8"
- any-glob-to-any-file: ".coveragerc"
- any-glob-to-any-file: ".codecimate.yml"
- any-glob-to-any-file: "ignore_words.txt"
- any-glob-to-any-file: "mypy.ini"
- any-glob-to-any-file: "pyproject.toml"
- any-glob-to-any-file: "setup.py"
dependencies:
- any:
- changed-files:
- any-glob-to-any-file: 'requirements*'
- any-glob-to-any-file: 'environment.yml'
- any:
- changed-files:
- any-glob-to-any-file: "requirements*"
- any-glob-to-any-file: "environment.yml"
37 changes: 18 additions & 19 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:

env:
ALLOW_PLOTTING: true
SHELLOPTS: 'errexit:pipefail'
SHELLOPTS: "errexit:pipefail"

jobs:
doc:
Expand All @@ -27,8 +27,8 @@ jobs:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
python-version: "3.11"
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Install pytest-pyvista with test dependencies
Expand Down Expand Up @@ -59,22 +59,22 @@ jobs:

matrix:
include:
- python-version: '3.9'
vtk-version: '9.1'
- python-version: '3.10'
vtk-version: '9.2.2'
- python-version: '3.11'
vtk-version: 'latest'
- python-version: '3.12'
vtk-version: 'latest'
- python-version: "3.9"
vtk-version: "9.1"
- python-version: "3.10"
vtk-version: "9.2.2"
- python-version: "3.11"
vtk-version: "latest"
- python-version: "3.12"
vtk-version: "latest"
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache: "pip"
cache-dependency-path: pyproject.toml

- name: Install pytest-pyvista with test dependencies
Expand Down Expand Up @@ -104,15 +104,14 @@ jobs:
run: xvfb-run coverage run -m --source=pytest_pyvista --module pytest --verbose .
- uses: codecov/codecov-action@v4
if: matrix.python-version == '3.9'
name: 'Upload coverage to CodeCov'
name: "Upload coverage to CodeCov"

release:
name: Release
if: |
github.event_name == 'push' &&
contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -147,15 +146,15 @@ jobs:
downstream:
name: Downstream tests
runs-on: ubuntu-20.04 # matching pyvista
runs-on: ubuntu-20.04 # matching pyvista
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: "3.11"

- run: git clone --depth=1 https://github.com/pyvista/pyvista.git --branch main --single-branch

- name: Install pyvista
run: pip install -ve .
working-directory: pyvista
Expand All @@ -170,11 +169,11 @@ jobs:
which python
pip list
working-directory: pyvista

- name: Unit Testing
run: xvfb-run python -m pytest --fail_extra_image_cache -v --generated_image_dir gen_dir tests/plotting/test_plotting.py
working-directory: pyvista

- name: Upload generated image artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand Down
74 changes: 37 additions & 37 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,41 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Label based on changed files
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Label based on changed files
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

# Label based on branch name
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'doc/') || startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'docker')
with:
labels: docker
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'maint') || startsWith(github.event.pull_request.head.ref, 'no-ci') || startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'junk')
with:
labels: ignore-for-release
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: enhancement
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'fix') || startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'release')
with:
labels: release
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'breaking-change')
with:
labels: breaking-change
# Label based on branch name
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'doc/') || startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'docker')
with:
labels: docker
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'maint') || startsWith(github.event.pull_request.head.ref, 'no-ci') || startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'junk')
with:
labels: ignore-for-release
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
labels: enhancement
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'fix') || startsWith(github.event.pull_request.head.ref, 'patch')
with:
labels: bug
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'release')
with:
labels: release
- uses: actions-ecosystem/action-add-labels@v1
if: startsWith(github.event.pull_request.head.ref, 'breaking-change')
with:
labels: breaking-change
96 changes: 52 additions & 44 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,60 @@ ci:
autoupdate_schedule: monthly

repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [
"doc examples examples_flask pytest-pyvista tests",
"*.py *.rst *.md",
]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args:
[
"doc examples examples_flask pytest-pyvista tests",
"*.py *.rst *.md",
]

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: [toml==0.10.2]
files: ^(pytest-pyvista/|other/)
exclude: ^pytest-pyvista/ext/
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: [toml==0.10.2]
files: ^(pytest-pyvista/|other/)
exclude: ^pytest-pyvista/ext/

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
exclude: ^(doc/|tests/|examples/|pytest-pyvista/ext/|examples_flask/)
additional_dependencies: [
"mypy-extensions==1.0.0",
"toml==0.10.2",
"typing-extensions==4.12.2",
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
exclude: ^(doc/|tests/|examples/|pytest-pyvista/ext/|examples_flask/)
additional_dependencies:
[
"mypy-extensions==1.0.0",
"toml==0.10.2",
"typing-extensions==4.12.2",
]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: no-commit-to-branch
args: [--branch, main]
- id: requirements-txt-fixer
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: no-commit-to-branch
args: [--branch, main]
- id: requirements-txt-fixer

# this validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.3
hooks:
- id: check-github-workflows
# this validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.3
hooks:
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]

0 comments on commit aea09d3

Please sign in to comment.