diff --git a/.github/workflows/pretty.yml b/.github/workflows/pretty.yml index f2c1fd761..68ea46ea8 100644 --- a/.github/workflows/pretty.yml +++ b/.github/workflows/pretty.yml @@ -15,5 +15,5 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Count + - name: Format diff run: ./mfc.sh format diff diff --git a/src/common/include/inline_conversions.fpp b/src/common/include/inline_conversions.fpp index ec02ccfe8..9811290a8 100644 --- a/src/common/include/inline_conversions.fpp +++ b/src/common/include/inline_conversions.fpp @@ -20,7 +20,7 @@ c = (1d0/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2))) elseif (model_eqns == 3) then c = 0d0 -!$acc loop seq + !$acc loop seq do q = 1, num_fluids c = c + adv(q)*(1d0/gammas(q) + 1d0)* & (pres + pi_infs(q)/(gammas(q) + 1d0)) diff --git a/src/common/include/macros.fpp b/src/common/include/macros.fpp index 2f2d2fcf6..b33eb1f17 100644 --- a/src/common/include/macros.fpp +++ b/src/common/include/macros.fpp @@ -22,7 +22,7 @@ #:def DEALLOCATE(*args) @:LOG({'@:DEALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'}) deallocate (${', '.join(args)}$) - !$acc exit data delete(${', '.join(args)}$) +!$acc exit data delete(${', '.join(args)}$) #:enddef DEALLOCATE #define t_vec3 real(kind(0d0)), dimension(1:3) diff --git a/toolchain/bootstrap/format.sh b/toolchain/bootstrap/format.sh index e4853a40c..ccafd4fc9 100644 --- a/toolchain/bootstrap/format.sh +++ b/toolchain/bootstrap/format.sh @@ -19,7 +19,10 @@ if [ "$1" == "diff" ]; then fi # Indent acc directives -for filename in src/*/*.f*; do +srcfiles=( src/*/*.f* ) +includefiles=( src/*/include/*.f* ) +files=( "${srcfiles[@]}" "${includefiles[@]}" ) +for filename in ${files[@]}; do python3 toolchain/indenter.py "$filename" done diff --git a/toolchain/indenter.py b/toolchain/indenter.py old mode 100755 new mode 100644 index 0779111e4..a535ccc2e --- a/toolchain/indenter.py +++ b/toolchain/indenter.py @@ -5,13 +5,14 @@ def main(): num_args = len(sys.argv) if num_args != 2: - AssertionError('Invalid number of arguments, found ', num_args) + raise Exception('Invalid number of arguments, found ', num_args) infile = str(sys.argv[1]) outfile = infile+".new" adjust_indentation(infile, outfile) os.replace(outfile,infile) +# pylint: disable=too-many-branches def adjust_indentation(input_file, output_file): startingchar='!$acc' startingloop1='!$acc parallel loop' @@ -22,8 +23,10 @@ def adjust_indentation(input_file, output_file): lines = file_in.readlines() # this makes sure !$acc lines that have line continuations get indented at proper level - for kk in range(10): + # pylint: disable=too-many-nested-blocks + for _ in range(10): # loop through file + # pylint: disable=consider-using-enumerate for i in range(len(lines)): if lines[i].lstrip().startswith(startingchar) and i + 1 < len(lines): j = i + 1 @@ -50,7 +53,7 @@ def adjust_indentation(input_file, output_file): while k >= 0: # if line above is not empty if lines[k].strip() != '': - # if line 2 above ends with line continuation, indent at that level + # if line 2 above ends with line continuation, indent at that level if lines[k-1].strip().endswith('&'): indent = len(lines[k-1]) - len(lines[k-1].lstrip()) # else indent at level of line above