Skip to content

Commit

Permalink
formatting examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryngelson committed Dec 26, 2024
1 parent 2946d9c commit 9c67f00
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch]

jobs:
docs:
name: Code formatting
name: Formatting
runs-on: ubuntu-latest

steps:
Expand Down
9 changes: 7 additions & 2 deletions toolchain/bootstrap/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ log "Formatting MFC:"

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

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

ok "Done. MFC has been formatted."
8 changes: 8 additions & 0 deletions toolchain/bootstrap/format_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

. toolchain/util.sh

echo "> $1"

black -l 200 -x "$1" &>/dev/null 2>&1

1 change: 1 addition & 0 deletions toolchain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies = [
"typos",
"pylint",
"fprettify",
"black",

# Profiling
"numpy",
Expand Down

0 comments on commit 9c67f00

Please sign in to comment.