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

Apply prmindent to PRM files #17038

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paulapatience
Copy link

This PR applies the PRM formatter prmindent to almost all PRM files in deal.II. Assuming prmindent is available in PATH, you can reproduce the results by running the following in the root directory of deal.II:

find . -path ./tests/parameter_handler -prune -o -name '*.prm' -execdir prmindent -i '{}' \;

(If you have mawk or gawk installed, installing prmindent should be just a question of making the script executable and placing it somewhere in your PATH. Or you could also read its installation instructions.)

This PR is a follow-up to @bangerth's suggestion on the mailing list. To summarize the situation: I wrote prmindent for use in Lethe some time ago, and @bangerth said it could be added to deal.II's contrib/utilities. This PR is an opportunity to discuss prmindent's formatting (and eventually to format deal.II's PRM files). If it is accepted, I will submit another PR adding prmindent to contrib/utilities.

On the whole, I am quite happy with the changes, which are few. However, there are some issues, which I will discuss presently.

The main difference with the current PRM style in deal.II is that values are aligned only if not separated by blank lines or comments. This style is not scrupulously followed throughout deal.II, so I do not foresee it being an issue. Also, top-level blocks, i.e., subsections or groups of entries, are separated by a blank line.

One discrepant formatting style currently applied by prmindent is the addition of blank lines between comments and top-level subsections or entries (this is actually an artifact of separating top-level blocks). Another is that prmindent currently adds a trailing space for entries with no value. I will fix these.

Finally, some of the pathological ParameterHandler test cases in tests/parameter_handler are handled somewhat poorly, specifically those involving backslashes. I have not applied prmindent to the ParameterHandler test files, as they have presumably been carefully crafted.

Also, I do not know if multiline multiple parameter loops are common, but prmindent treats them only as ordinary values, so it will not align them in any way.

Feel free to comment on prmindent's style and make any requests. The time for bikeshedding is now.

The command was:

  find . -path ./tests/parameter_handler -prune \
    -o -name '*.prm' -execdir prmindent -i '{}' \;

In other words, PRM files in tests/parameter_handler were skipped, since
some were carefully crafted to test ParameterHandler.
@blaisb
Copy link
Member

blaisb commented May 17, 2024

I think @tamiko was interested in this.

@bangerth bangerth added this to the Release 9.6 milestone May 17, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants