#!/bin/bash echo "Formatting..." dotnetFormatted=0 rustFormatted=0 pythonFormatted=0 docsGenerated=0 for f in $(git diff --name-only --diff-filter=ACM) do if [[ $dotnetFormatted == 0 ]] && [[ $f == src/ApiService/* ]]; then echo "Formatting dotnet" cd /workspaces/onefuzz/src/ApiService dotnet format dotnetFormatted=1 fi if [[ $rustFormatted == 0 ]] && [[ $f == src/agent/* ]]; then echo "Formatting rust" cd /workspaces/onefuzz/src/agent cargo fmt --all rustFormatted=1 fi if [[ $pythonFormatted == 0 ]] && [[ $(grep -Eq 'src/(cli|api-service|pytypes)/*' <<< $f) ]]; then echo "Formatting python" cd /workspaces/onefuzz/src/utils ./lint.sh pythonFormatted=1 fi if [[ $docsGenerated == 0 ]] && [[ $f == src/pytypes/* ]]; then echo "Generating docs" cd /workspaces/onefuzz/src/pytypes python extra/generate-docs.py ../../docs/webhook_events.md docsGenerated=1 fi if [[ $dotnetFormatted == 1 ]] && [[ $rustFormatted == 1 ]] && [[ $pythonFormatted == 1 ]] && [[ $docsGenerated == 1 ]]; then break fi done echo "Done formatting"