fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
376 stars 78 forks source link

New option --reset-indent to reset indentation to 0 at the begining o… #53

Closed meteokid closed 3 years ago

meteokid commented 5 years ago

New option --reset-indent to reset indentation to 0 at the beginning of a file if it matches program/module/sub/func


$ cat test.F90
     subroutine a()
     do i=1,4
     print *,i
     enddo
     end subroutine

$ fprettify.py -s --strict-indent -- test.F90
     subroutine a()
        do i = 1, 4
           print *, i
        enddo
     end subroutine

$ fprettify.py -s --strict-indent --reset-indent -- test.F90
subroutine a()
   do i = 1, 4
      print *, i
   enddo
end subroutine
pseewald commented 5 years ago

Do you think there is a use case for matching subroutine and function? If we can remove these, the behaviour for module and program can be made default and we don't even need the --strict-indent option.