fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
376 stars 78 forks source link

Add --enable-swap-case: change known keywords and constants character… #46

Closed meteokid closed 5 years ago

meteokid commented 5 years ago

This patch allow changing character case of keywords (up to Fortran 2008) and some known constants (list taken from emacs' F90 mode). For now keywords are lowercased and constants are uppercased. It would be easy to add options so one can choose its preferred case. I'll do it if there is a need (didn't want to crowd the option list too much).

meteokid commented 5 years ago

My bad, sorry. Let me work on Python 3 fixes... I'll update the merge request.

meteokid commented 5 years ago

Patch for python3 is in. Tested on a small test case (fortran_tests/{before,after}) and on my big codebase.

Looks like there is no specific test for the new option runned by the Travis.CI since code coverage has reduced (I can only suppose the new code is not tested). If someone can point me in the right direction, I can add tests for Travis.CI specific for this new option.

Thanks!

pseewald commented 5 years ago

Thank you!

There is an easy way to add unit tests to test non-default options on small code snippets: you simply extend the class FPrettifyTestCase by new methods starting with test_

meteokid commented 5 years ago

test_swap_case was added so Travis CI can check "--enable-swap-case" option. All tests passes. Let me know if anything needs to be done to integrate this patchset into the official version of fprettify.

meteokid commented 5 years ago

Closing... Replaced with the following pull request https://github.com/pseewald/fprettify/pull/49