Closed BaconPancakes closed 3 years ago
I consider the above formatting as inconsistent since the first part of the module content is indented (everything before contains
) but the second part (everything after contains
) is not. Also I've never seen this in any fortran project.
We’re following something akin to https://www.fortran90.org/src/best-practices.html
But after thinking about it, you’re right, it’s not exactly consistent. The idea is that a single subroutine is the meat of the file, so having two levels of indenting after the contains statement is unwieldy (and unnecessary, since we only ever use contains once).
Perhaps the consistent approach is as you say, not to indent at the “module” level, but only at the procedure level.
Perhaps the consistent approach is as you say, not to indent at the “module” level, but only at the procedure level.
This sounds reasonable and useful, so we should make it an option (leaving the default as it is now). Unfortunately I don't have time at the moment. If you'd like to give it a try yourself, the scopes (or levels) are defined here: just removing MOD_RE
, CONTAINS_RE
and ENDMOD_RE
from the dictionaries should give you what you want.
Those edits seem to work well. Thanks.
Thanks for your feedback, I'll make this an option once I find time.
I know formatters are opinionated and all, but can we have have an option to keep the subroutine definitions at the same level as the contains statement, like below? This is actually a bit of a dealbreaker for me (and the codebase that I maintain).