Code formatting + style cleanup in sipnet, workflow, ERA5
Description
Code style edits: None should change output, most are whitespace changes.
I was reading the code in write.configs.SIPNET and realized the uneven spacing around operators was slowing down my reading, and decided to run styler::style_pkg() on the whole sipnet and workflow packages while I was at it.
I used styler's default styling settings to align with tidyverse style. I have some quibbles (e.g. it really wants the closing paren of a multi-line function call to be on its own line where I'd prefer it immediately after the last parameter), but none big enough to bother overriding.
Motivation and Context
Review Time Estimate
- [ ] Immediately
- [ ] Within one week
- [ ] When possible
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] My name is in the list of CITATION.cff
- [ ] I agree that PEcAn Project may distribute my contribution under any or all of
- the same license as the existing code,
- and/or the BSD 3-clause license.
- [ ] I have updated the CHANGELOG.md.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
Maybe Fixes Styling Section of #3280
@Sweetdevil144 This PR manually fixes the styling of a few files, but alas it doesn't implement the automated styling that #3280 wishes for. I'd still love to have that!
@infotroph I just finished creating a script that automated styling using the styler package. Although the script takes forever to run as it navigates in all folders in all directories (it's been 10 minutes and the script still formats) due to the enormous size of file reading. I'm thinking of caching the formatted files in a local file which stores pre formatted files as follows : Read files from added files for committing. Simply format the files which have been changed. May include newly created files.
This works because I'll format and add all previous formatted files in the current project in the cached file systems, so only the modified or new files from in commits will be acted upon. Note that this would work as I will add a new pre-commit rule so after each commit, all filled would be styled.
Be aware that the last time someone tried to apply style rules to the entire PEcAn repo, there were a fairly large number of places where manual reversions to the original code were required. I'm not up for having to fight an automated stylizer on every PR (or even periodically). I also want to make sure anything that gets implemented doesn't increase the bar of frustration that new members of the team feel when trying to learn how to submit successful PRs (too much time is already spent making changes that are not in bits of code the individual touched)
I'll say more about automated styling in #3280; For this thread let's focus on whether to merge these specific changes.
Thanks for the review, @mdietze. I'll leave followup on some specific points inline, but I think the basic takeaway is that the bog-standard default output from {styler} isn't acceptable enough to adopt as it is. I'll see if I can find settings that come closer, but if not we should close this rather than try to manually massage individual lines.
Closing this; the sipnet package has changed a lot since I opened it and resolving the conflicts would be a nightmare even if we were 100% happy with all the format details. Let's make sure to refer back to this for any future development of code styling tools.