-
Notifications
You must be signed in to change notification settings - Fork 78
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
Fixes and new options #99
base: master
Are you sure you want to change the base?
Conversation
Thanks a lot!
This goes back to pr #53 which I made default later on. There is no option to disable this as I thought that program / module should have 0 indent in any case. fprettify only supports free format. I don't agree with removing indent for subroutine / function by default, fprettify can also be applied to parts of a file (e.g. when used within an editor) and there removing indent for subroutine / function is not the expected behaviour. Do you reallly need this? If yes, could you make it an option?
Do you really need this? I don't think this is a reasonable convention but I'd accept this option if you really see a use case for it.
I was not aware of this, thanks for catching and fixing this. I'll extend tests to this case. Thanks a lot for the more fine-grained whitespace options which are very welcome! Would you have time to also add unit tests for the new options (just add new methods |
The point was first make a fixed-format file free-format compatible (https://software.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/program-elements-and-source-forms/source-forms/source-code-useable-for-all-source-forms.html) manually or with some other tool, and then use fprettify to, among other things, remove the unnecessary 6-column indent.
Oh, I didn't think of applying fprettify to a partial file, then I agree on not doing it by default. But I have plenty of files that contain only a single subroutine/function, and I want to force it to 0 indent. I'll add an option (
"Need" is a strong word, but I do want it. As above, when a file contains only a subroutine or function, it feels like a waste to indent every line. Isn't that the same reasoning behind |
Ok, then you can reintroduce the option
Yes it is and please go ahead if this feature is useful to you. |
Anything else I should do? |
What do you mean? There are some new tests in |
@gnikit, I think this PR looks good, and can be approved. I found Maybe this Do not crash when both --disable-indent and --disable-whitespace are passed could be improved, since it only avoids crashing, but still have no effect (ref #163). But I still suggest to merged it. |
A couple of fixes:
else
andelse if
statements can have a construct name at the end, just likeend if
(http://www.lahey.com/docs/lfprohelp/F95ARIFConst.htm)program
ormodule
. Now it's also removed if it'ssubroutine
orfunction
. (Is an option needed for this behavor? What's the reason for this?)1.0_Wp
)--disable-indent
and--disable-whitespace
are passedAnd new whitespace options:
--whitespace-end
: add/remove space inend if
,end do
, etc. By default the same as--whitespace-intrinsics
--whitespace-only
: add/remove space after the colon inuse ... only: ...
. By default the same--whitespace-comma
--whitespace-if
: add/remove space before the parenthesis inif (...
,while (...
andcase (...
. By default the same as--whitespace-intrinsics
--whitespace-do
: add/remove space around the "assignment" indo
statements. By default the same--whitespace-assignment
--whitespace-list
: add/remove space after commas in list of variables of declarations anduse
statements (not in argument lists). By default the same as--whitespace-comma
--disable-indent-first
: disable indent of the topmost level (similar to--disable-indent-mod
, but also for subroutines and functions)--indent-select
: double indent ofselect
blocks, such as e.g.case
statements are indented once and the code inside is indented twice.