You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extremely poorly written code often does not have a consistent styling between statements. As it currently stands findent will not try and fix that. I am curious if this is a useful feature for findent to have
MWE
program main
implicit nonereal:: b(3,3)
integer:: j, k
b = foo( 10 )
write (*, '(*(g0))') ( ( b (j, k) , '', k =1 , 3 ), new_line('A'), j =1, 3)
containsfunctionfoo ( var ) result( res )
integer , intent( in ) :: var
real, dimension( 3 , 3 ) :: res
integer:: i
res( : , 1 ) = [ 0, 1 , 2 ]
res( : , 2 ) = (/4 , 5, 6/)
callrandom_number ( res( :, 3 ) )
if ( any ( res( :, 3) > 0.5 ) ) thendo i =3 , 1 , -1
res( i , 3) =-i
end doend ifprint* , 'nightmare fuel'endfunction fooend program main
Formatted
A formatted version of that should roughly look something like this (this preserves the number of lines)
program main
implicit nonereal:: b(3, 3)
integer:: j, k
b = foo(10)
write (*, '(*(g0))') ((b(j, k), '', k=1, 3), new_line('A'), j=1, 3)
containsfunctionfoo(var) result(res)
integer, intent(in) :: var
real, dimension(3, 3) :: res
integer:: i
res(:, 1) = [0, 1, 2]
res(:, 2) = (/4, 5, 6/)
callrandom_number(res(:, 3))
if (any(res(:, 3) > 0.5)) thendo i =3, 1, -1
res(i, 3) =-i
end doend ifprint*, 'nightmare fuel'endfunction fooend program main
This issue goes into styling preferences, which are highly subjective, and to the best of my knowledge are not really standardised in Fortran. But I would argue that having the option to impose a consistent styling across a file is better than not.
More than happy to work on this.
The text was updated successfully, but these errors were encountered:
Extremely poorly written code often does not have a consistent styling between statements. As it currently stands findent will not try and fix that. I am curious if this is a useful feature for findent to have
MWE
Formatted
A formatted version of that should roughly look something like this (this preserves the number of lines)
This issue goes into styling preferences, which are highly subjective, and to the best of my knowledge are not really standardised in Fortran. But I would argue that having the option to impose a consistent styling across a file is better than not.
More than happy to work on this.
The text was updated successfully, but these errors were encountered: