Skip to content

Commit 9c67f00

Browse files
committed
formatting examples
1 parent 2946d9c commit 9c67f00

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

.github/workflows/formatting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
docs:
7-
name: Code formatting
7+
name: Formatting
88
runs-on: ubuntu-latest
99

1010
steps:

toolchain/bootstrap/format.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ log "Formatting MFC:"
1919

2020
if ! find ${@:-src} -type f | grep -Ev 'autogen' | grep -E '\.(f90|fpp)$' \
2121
| xargs -L 1 -P ${JOBS:-1} $SHELL toolchain/bootstrap/format_file.sh; then
22-
error "Formatting MFC failed."
22+
error "Formatting MFC source failed."
2323
exit 1
2424
fi
2525

26-
ok "Done. MFC has been formatted."
26+
if ! find ${@:-examples} -type f | grep -E '\.(py)$' \
27+
| xargs -L 1 -P ${JOBS:-1} $SHELL toolchain/bootstrap/format_python.sh; then
28+
error "Formatting MFC examples failed."
29+
exit 1
30+
fi
2731

32+
ok "Done. MFC has been formatted."
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
. toolchain/util.sh
4+
5+
echo "> $1"
6+
7+
black -l 200 -x "$1" &>/dev/null 2>&1
8+

toolchain/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies = [
2525
"typos",
2626
"pylint",
2727
"fprettify",
28+
"black",
2829

2930
# Profiling
3031
"numpy",

0 commit comments

Comments
 (0)