Skip to content

Commit

Permalink
add precommit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Mar 15, 2024
1 parent edcaa66 commit 853ffd5
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# (C) Copyright 2024 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
#

name: QA

on:
push:
branches:
- "*"

jobs:
quality:
name: QA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install pre-commit
- run: pre-commit install
- run: pre-commit run --all-files

notify-failure:
if: failure()
runs-on: ubuntu-latest
needs: quality
name: Notify failure
steps:
- uses: jdcargile/[email protected]
with:
github-token: ${{ github.token }}
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI_F }}
# notification-summary: ${{ steps.qa.outputs.status }}
notification-summary: ❌ Build failed on anemoi-docs!
notification-color: dc3545
timezone: Europe/Paris
verbose-logging: true

notify-success:
if: success()
runs-on: ubuntu-latest
needs: quality
name: Notify success
steps:
- uses: jdcargile/[email protected]
with:
github-token: ${{ github.token }}
ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI_F }}
# notification-summary: ${{ steps.qa.outputs.status }}
notification-summary: ✅ New commit on anemoi-docs.
notification-color: 17a2b8
timezone: Europe/Paris
verbose-logging: true
71 changes: 71 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# (C) Copyright 2024 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
#
#
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml # Check YAML files for syntax errors only
args: [--unsafe, --allow-multiple-documents]
# - id: debug-statements # Check for debugger imports and py37+ breakpoint()
# - id: end-of-file-fixer # Ensure files end in a newline
# - id: trailing-whitespace # Trailing whitespace checker
# - id: no-commit-to-branch # Prevent committing to main / master
# - id: check-added-large-files # Check for large files added to git
# - id: check-merge-conflict # Check for files that contain merge conflict
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
hooks:
- id: black
# args: [--line-length=120]

- repo: https://github.com/dzhu/rstfmt
rev: v0.0.14
hooks:
- id: rstfmt

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
hooks:
- id: rstcheck
args:
- '--ignore-roles'
- 'doc'
- '--ignore-directives'
- 'toctree'

#- repo: https://github.com/pycqa/isort
# rev: 5.13.2
# hooks:
# - id: isort
# args:
# - -l 120
# - --force-single-line-imports
# - --profile black
#- repo: https://github.com/pycqa/flake8
# rev: 7.0.0
# hooks:
# - id: flake8
# # args: [--exit-zero]
# # verbose: true
#- repo: https://github.com/astral-sh/ruff-pre-commit
# rev: v0.3.0
# hooks:
# - id: ruff
# args:
# - --line-length=120
# - --fix
# - --exit-non-zero-on-fix
# - --preview
#- repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.720
# hooks:
# - id: mypy
# verbose: true
# entry: bash -c 'mypy "$@" || true' --

0 comments on commit 853ffd5

Please sign in to comment.