Skip to content

Commit

Permalink
MAINT: autoupdate pre-commit hooks (#38)
Browse files Browse the repository at this point in the history
* DX: apply new ComPWA dev configuration
* MAINT: address linting issues

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Remco de Boer <29308176+redeboer@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] and redeboer authored Apr 6, 2024
1 parent f44fb8d commit 96f2f2b
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 111 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"tox.ini"
],
"language": "en-US",
"words": ["ComPWA", "conda", "doctests", "pdgref", "pytest"],
"words": ["ComPWA", "conda", "doctests", "pdgref", "PyPA", "pytest"],
"ignoreWords": [
"MAINT",
"PYTHONHASHSEED",
Expand All @@ -49,6 +49,7 @@
"pypi",
"pyquery",
"pyright",
"redeclaration",
"rtfd",
"sdist",
"setuptools",
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,22 @@ jobs:
milestone:
if: startsWith(github.ref, 'refs/tags')
uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1
package-name:
uses: ComPWA/actions/.github/workflows/get-pypi-name.yml@v1
pypi:
environment:
name: PyPI
url: https://pypi.org/p/${{ needs.package-name.outputs.name }}
if: startsWith(github.ref, 'refs/tags')
secrets: inherit
uses: ComPWA/actions/.github/workflows/publish-to-pypi.yml@v1
name: Publish to PyPI
needs:
- package-name
permissions:
id-token: write
runs-on: ubuntu-22.04
steps:
- uses: ComPWA/actions/build-pypi-distribution@v1
- uses: pypa/gh-action-pypi-publish@release/v1
push:
if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease
secrets: inherit
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
cancel-in-progress: |-
${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
env:
PYTHONHASHSEED: "0"
Expand Down
23 changes: 2 additions & 21 deletions .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,5 @@ on:
- unlabeled

jobs:
check-labels:
name: Check labels
runs-on: ubuntu-22.04
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest # cspell:ignore agilepathway
with:
any_of: >-
🐛 Bug,✨ Feature,⚙️ Enhancement,⚠️ Interface,❗ Behavior,📝 Docs,🔨 Maintenance,🖱️ DX
none_of: Epic,💫 Good first issue
repo_token: ${{ secrets.GITHUB_TOKEN }}

check-title:
name: Check title
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: npm install @compwa/commitlint-config
- name: Create commitlint config
run: |
echo "module.exports = {extends: ['@compwa/commitlint-config']}" > commitlint.config.js
- uses: JulienKode/pull-request-name-linter-action@v0.5.0 # cspell:ignore kode
lint-pr:
uses: ComPWA/actions/.github/workflows/pr-linting.yml@v1
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-22.04
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ vscode:
- editorconfig.editorconfig
- esbenp.prettier-vscode
- github.vscode-github-actions
- ms-python.black-formatter
- ms-python.mypy-type-checker
- ms-python.python
- ms-python.vscode-pylance
- redhat.vscode-yaml
- ryanluker.vscode-coverage-gutters
- Soulcode.vscode-unwanted-extensions
- soulcode.vscode-unwanted-extensions
- stkb.rewrap
- streetsidesoftware.code-spell-checker
- tamasfe.even-better-toml
- tyriar.sort-lines
- yzhang.markdown-all-in-one
56 changes: 23 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes

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

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down Expand Up @@ -41,18 +48,25 @@ repos:
)$
- id: trailing-whitespace

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: black
- id: taplo

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: blacken-docs
- id: toml-sort
args:
- --in-place

- repo: https://github.com/ComPWA/policy
rev: 0.2.2
rev: 0.3.4
hooks:
- id: check-dev-files
args:
Expand All @@ -62,7 +76,7 @@ repos:
- --repo-title=sphinx-hep-pdgref

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.3.0
rev: v8.6.1
hooks:
- id: cspell

Expand All @@ -86,31 +100,7 @@ repos:
types:
- python

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.345
rev: v1.1.357
hooks:
- id: pyright

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: ruff
args:
- --fix

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: taplo

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort
args:
- --in-place
8 changes: 4 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"ms-python.black-formatter",
"ms-python.mypy-type-checker",
"ms-python.python",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"Soulcode.vscode-unwanted-extensions",
"soulcode.vscode-unwanted-extensions",
"stkb.rewrap",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml",
"tyriar.sort-lines",
"yzhang.markdown-all-in-one"
],
"unwantedRecommendations": [
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"garaioag.garaio-vscode-unwanted-recommendations",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-python.pylint",
"travisillig.vscode-json-stable-stringify"
"travisillig.vscode-json-stable-stringify",
"tyriar.sort-lines"
]
}
16 changes: 12 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"rewrap.wrappingColumn": 72
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.wordWrap": "on"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand All @@ -22,13 +23,12 @@
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [88]
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"black-formatter.importStrategy": "fromEnvironment",
"coverage-gutters.coverageFileNames": ["coverage.xml"],
"coverage-gutters.coverageReportFileName": "**/htmlcov/index.html",
"coverage-gutters.showGutterCoverage": false,
Expand All @@ -45,22 +45,30 @@
"git.rebaseWhenSync": true,
"github-actions.workflows.pinned.refresh.enabled": true,
"github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"],
"gitlens.telemetry.enabled": false,
"multiDiffEditor.experimental.enabled": true,
"mypy-type-checker.args": ["--config-file=${workspaceFolder}/pyproject.toml"],
"mypy-type-checker.importStrategy": "fromEnvironment",
"notebook.codeActionsOnSave": {
"notebook.source.organizeImports": "explicit"
},
"notebook.formatOnSave.enabled": true,
"python.analysis.autoImportCompletions": false,
"python.analysis.inlayHints.pytestParameters": true,
"python.analysis.typeCheckingMode": "strict",
"python.testing.pytestArgs": ["--color=no", "--no-cov"],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"redhat.telemetry.enabled": false,
"rewrap.wrappingColumn": 88,
"ruff.enable": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.organizeImports": true,
"search.exclude": {
"**/tests/**/__init__.py": true,
"*/.pydocstyle": true,
"src/*/*/__init__.py": true,
"src/*/__init__.py": true
}
},
"telemetry.telemetryLevel": "off"
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/sphinx-hep-pdgref/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/sphinx-hep-pdgref/main)
[![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

This package is a
Expand Down
Loading

0 comments on commit 96f2f2b

Please sign in to comment.