MetOffice / MetOffice/LFRic-Atmosphere-Training
Introducing formatter(s) and/or automated style check in CI?
- Dominant language
- Jupyter Notebook
- Stars
- 11
- Forks
- 6
- Avg merge
- 5d 19h
- Merged PRs (30d)
- 9
Description
C.f. #232. It is a known issues that line length can sometimes be too long and created friction in reviewing them. A quick and dirty check is implemented in #231 to prevent lines getting longer than then currently are.
A proper solution requires more discussions and engineering effort and potentially coordinations.
To start the discussion, just to name a few obvious starting points:
Introduction: Linters flags problems (it tells you what's wrong, e.g. line too long, wrong indentation levels, unnecessary white spaces, etc. Here we focus on styles only, some linters are more powerful than that), formatters fixes those problems automatically. Some do both. Examples of good Python formatters are black, ruff. Examples of RST formatters are docstrfmt or rstfmt (which I have no experience of and seems to be much less popular than the former and has known limitations.)
Pros of having automatic formatter(s):
- eliminate constant drifts in style from developments by multiple people in different PRs
- eliminate friction introduced from different opinion, so style problem would not become a blocker of PRs
Cons of introducing automatic formatter(s) now:
- The "genie is out of the bottle" so to speak, since many people are already forking and having different branches, a mass scale application of automated formatting would results in unwanted merge conflicts (conflict in change of styles between two branches that has and doesn't have the new formatting)
One potential solution to prevent these merge conflicts is to not batch reformat everything, but only reformat those lines changes in a PR (which if another branch touches it would results in merge conflicts anyway.) I am not sure the technical feasibility of this idea, but is worth exploring.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.