|
| 1 | +#! /bin/bash |
| 2 | + |
| 3 | +#SEARCHPATHS=(src srcbmi utils) |
| 4 | +SEARCHPATHS=(src) |
| 5 | +EXCLUDEDIRS=(src/Utilities/Libraries/blas # external library blas |
| 6 | + src/Utilities/Libraries/daglib # external library dag |
| 7 | + src/Utilities/Libraries/rcm # external library rcm |
| 8 | + src/Utilities/Libraries/sparsekit # external library sparsekit |
| 9 | + src/Utilities/Libraries/sparskit2) # external library sparsekit2 |
| 10 | +EXCLUDEFILES=(src/Utilities/InputOutput.f90) # excluded until refactored |
| 11 | + |
| 12 | +fformatfails=() |
| 13 | +checkcount=0 |
| 14 | + |
| 15 | +for path in "${SEARCHPATHS[@]}"; do |
| 16 | + readarray -d '' files < <(find "${path}" -type f -print0 | grep -z '\.[fF]9[0,5]$') |
| 17 | + for file in "${files[@]}"; do |
| 18 | + exclude=0 |
| 19 | + |
| 20 | + for d in "${EXCLUDEDIRS[@]}"; do |
| 21 | + [[ "${d}" == $(dirname "${file}") ]] && exclude=1 && break; done |
| 22 | + if [[ ${exclude} == 1 ]]; then continue; fi |
| 23 | + |
| 24 | + for f in "${EXCLUDEFILES[@]}"; do |
| 25 | + [[ "${f}" == "${file}" ]] && exclude=1 && break; done |
| 26 | + if [[ ${exclude} == 1 ]]; then continue; fi |
| 27 | + |
| 28 | + ((checkcount++)) |
| 29 | + |
| 30 | + if [[ ! -z $(fprettify -d -c ./distribution/.fprettify.yaml "${file}" 2>&1) ]]; then |
| 31 | + fformatfails+=("${file}") |
| 32 | + fi |
| 33 | + done |
| 34 | +done |
| 35 | + |
| 36 | +echo -e "\nFortran source files checked: ${checkcount}" |
| 37 | +echo -e "Fortran source files failed: ${#fformatfails[@]}\n" |
| 38 | + |
| 39 | +if [[ ${#fformatfails[@]} > 0 ]]; then |
| 40 | + for f in "${fformatfails[@]}"; do echo "${f}"; done |
| 41 | + |
| 42 | + echo -e "\nTo verify file format diff and/or warn in local environment run:" |
| 43 | + echo -e " 'fprettify -d -c <path to modflow6>/distribution/.fprettify.yaml <filepath>'\n\n" |
| 44 | + |
| 45 | + exit 1 |
| 46 | +fi |
| 47 | + |
| 48 | +exit 0 |
0 commit comments