fortran-lang / fprettify

auto-formatter for modern fortran source code

Home Page:https://pypi.python.org/pypi/fprettify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: fprettify fails when variable name is `ne`

flokno opened this issue · comments

I tried to format code which has a variable called ne used in the following way:

if (skipreference .and.  ne .gt. 0) then
   write (*,*) 'something'
   end if

Expected result:

if (skipreference .and. ne .gt. 0) then
   write (*, *) 'something'
end if

Actual result with fprettify 0.3.7:

if (skipreference.and .ne. gt.0) then
   write (*, *) 'something'
end if

I noticed when trying to compile the code, which obviously wasn't possible anymore.

@nbehrnd you are completely right with the non-optimal naming scheme, but maybe you'd agree that fprettify should not break the code as shown in the example irrespective of non-optimal naming?

I agree with you, there is too much trim (Fortran) or strip (Python)
frpettify engages on the sample code. Perhaps naïve, but a list-based
approach with the possible pitfalls (to consider both lowercase .lt.
as well as uppercase .LT.) may be part of the cure.