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

[Feature request] Support formatting options as modules #16

Open
marmistrz opened this issue Feb 3, 2017 · 1 comment
Open

[Feature request] Support formatting options as modules #16

marmistrz opened this issue Feb 3, 2017 · 1 comment
Labels
enhancement Enhancement to existing feature
Milestone

Comments

@marmistrz
Copy link

marmistrz commented Feb 3, 2017

I've seen a code which mixes .gt. and > - awful!
Thought about contributing this... but stumbled across the longish __init__.py.

It's very difficult to find out where such a thing should be added. What I thought about was: plugins.

If there were a directory plugins, then adding a new formatting option would be as simple as:

  1. Write the needed code in plugins/mynewplugin.py, matching a predefined interface (inheriting an ABC [1] ?)
  2. Register that in __init__.py, possibly binding that to command line options (there may be dependencies between plugins)

For example, replacing .gt. with > could be as simple as a find-and-replace. This would make the code much clearer and much easier to contribute to.

[1] https://pymotw.com/3/abc/

@pseewald
Copy link
Collaborator

pseewald commented Feb 7, 2017

It is an ongoing effort to decouple dependencies and I hope I will eventually come up with a more modular and organised code.

I did not yet think about extensibility of fprettify and my work was focused on whitespace changes only (other features are planned). Replacing the old .gt., ... with the more modern >, ... would be a very useful feature indeed.

I will think about what interface could be provided for plugins / new features. Probably the base class should provide functions get_fortran_line and set_fortran_line and some basic Fortran parsing utilities, mainly to separate comments and strings from Fortran statements.

@pseewald pseewald added the enhancement Enhancement to existing feature label Feb 7, 2017
@pseewald pseewald added this to the v0.4 milestone Sep 5, 2018
This was referenced May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing feature
Projects
None yet
Development

No branches or pull requests

2 participants