Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Refactor procedures ignores interface keyword #5

Open
gnikit opened this issue Sep 24, 2021 · 2 comments
Open

Bug: Refactor procedures ignores interface keyword #5

gnikit opened this issue Sep 24, 2021 · 2 comments

Comments

@gnikit
Copy link

gnikit commented Sep 24, 2021

Requesting to indent and refactor (-Rr) the following code the interface block is completely ignored.

   INTERFACE MatCreateShell
      SUBROUTINE MatCreateShell(comm,mloc,nloc,m,n,ctx,mat,ierr)
         use petsc
      MPI_Comm :: comm
      PetscInt :: mloc,nloc,m,n
      TYPE(integer) :: ctx
      Mat :: mat
      PetscErrorCode :: ierr
      END SUBROUTINE MatCreateShell
   END INTERFACE MatCreateShell

image

On a separate note, I understand that the -Rr | -RR are only meant to change the case of the end ... lines but it would be nice/reasonable if the casing of the of the function/subroutine/procedure/... also used the same casing e.g.

      subroutine MatCreateShell(comm,mloc,nloc,m,n,ctx,mat,ierr)
         use petsc
         MPI_Comm :: comm
         PetscInt :: mloc,nloc,m,n
         TYPE(integer) :: ctx
         Mat :: mat
         PetscErrorCode :: ierr
      end subroutine MatCreateShell
@wvermin
Copy link
Owner

wvermin commented Sep 25, 2021 via email

@gnikit
Copy link
Author

gnikit commented Sep 25, 2021

are there others too?

To the best of my knowledge no. Only things that spring to mind are labelled statements like label: where ().... but if the label is missing from the end where then that is invalid code, so we shouldn't have to worry about such cases.

About the case of the name of the subroutine/function/etc: findent takes the name as defined. I see no benefit in flattening the CamelCase.

I think there was a miscommunication. I meant the actual letter case of the Fortran keyword, not the subroutine name.
If you look at line 85 in the diff, END SUBROUTINE has become end subroutine. I think that is reasonable since we requested -Rr, but if you look at line 78, the keyword SUBROUTINE has remained unchanged which results into the funny looking code

SUBROUTINE name()
...
end subroutine name

As a side note, I agree with you about changing the case of function/sub/etc. names. For example this is a subroutine where having a camel case naming convention serves a purpose. The subroutine is an interface to a C function so using the exact same case as the C code helps keep searches simple and consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants