Skip to content

Commit

Permalink
Add pre-commit for liniting docs (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonis authored Mar 10, 2024
1 parent b6e860a commit 8175b7a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 15 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/check-markdown.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/check-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check code style
on:
push:
branches:
- main
- develop
pull_request:
branches:
- "*"

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout preCICE
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
check-latest: true
- name: Install pre-commit
run: pip install pre-commit
- name: Run checks
run: pre-commit run -a -v
- name: Git status
if: always()
run: git status
- name: Full diff
if: always()
run: git diff
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
# Official repo for default hooks
- repo: https://github.com/precice/precice-pre-commit-hooks
rev: 'v3.3'
hooks:
- id: format-precice-config
- id: check-image-prefix
args: [ --prefix=docs-adapter-openfoam- ]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.30.0
hooks:
- id: markdownlint
files: "^docs/.*.md"
- id: markdownlint-fix
files: "^docs/.*.md"
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ merge conflicts and we will merge these files at the time we release a new versi

## Code formatting

You can format all files with clang-format 11 by running `./tools/format-code.sh`.
We use [pre-commit](https://pre-commit.com/) to ensure consistent formatting.
Please install `pre-commit` and then install the hook in this repository with `pre-commit install`.
This ensures correct formatting for future commits.
Run `pre-commit run -va` to apply formatting retrospectively.

## Automatic checks

Expand Down

0 comments on commit 8175b7a

Please sign in to comment.