Replies: 2 comments 6 replies
-
It feels like a task for an automation tool. There is an unfinished project, and this would be a tour de force test for a source code formatter. It would be an opportunity to test its idempotence, robustness, etc. The downside is that it would mess with git history. The best approach might be to enforce the guidelines only on lines that will be changed. EDIT: Please ignore. I thought you were referring to Class files, not Class helpfiles. In this case, it's 100% positive |
Beta Was this translation helpful? Give feedback.
-
@capital-G offered the following feedback on the PR, but I'll copy it here, because it could be a good thing to consider for a "bigger picture" update related to CI and the PR submission process.
The regex criteria I used unfortunately still required lots of manual checking to catch the ~5+% of outliers for any given search. To get this to be fully automated is another task entirely. I know that "the great reformat" took a very long time and some tireless work to finally get all the rules tuned up in the linter. Another point is that these changes are largely whitespace, so notably a few rules aren't included. These would be pretty high-impact changes, but I think tougher to implement, namely: For a proper CI hook, these should probably be included. That said, I'm admittedly not a regex wizard, so someone familiar with this is welcome to give it a go! I'll include the criteria I used in the final commit description for that ambitious person to use as a starting point :)
That would be very nice! Maybe that effort would inspire someone to slowly chip away at implementing it. |
Beta Was this translation helpful? Give feedback.
-
I’ve created a draft PR to reformat aspects of the code in the Help docs [#6306] (class help files only for now, not tutorials, overviews, etc.). This discussion space is for general comment/concerns about the idea. For feedback on specific changes, please comment on the PR directly.
[Meta: Why a Discussion on this? This may also have been an RFC, but RFCs seem geared for collaborating on a plan of action, while this is basically (mostly) done, given the current scope, and I wanted to just check here for any opinions that present yellow flags rather than sidetracking the PR. Maybe this is actually straightforward and the PR thread is enough...]
Background & Motivation
The general motivation is that the docs vary widely in quality and consistency of code examples, and this is a step toward cleaning it up. There are almost no syntactic changes, the vast majority of changes here are just handling whitespace. Here are some advantages of the change:
Experienced users made lots of these examples, and their personal styles were imprinted in examples—it seems much of the “loose” formatting or compact style was convenient for them to type but not for users to read.
Before releasing the PR for review I wanted to gauge any concerns people may have. One reason is because, while I don’t think this is a contentious move like the codebase reformatting, it does touch hundreds of files.
Luckily we already have style guidelines that (hopefully) make the changes fairly uncontroversial. But there may be outlying concerns and subsets of files that should remain idiomatic (Pattern classes come to mind) despite being less in line with agreed upon style, which was arrived at only relatively recently.
This was not a fully automated task, for better or worse. There was plenty of bulk replace on a file-by-file basis, one rule or partial rule at a time. I had my eyes on the changes at least 3 times: at the time of change, reviewing each commit (going through hundreds of files for each), then a final pass through it all again. In the final pass I caught ~3% error rate, so I’m fairly confident in the final result. That said, it’s likely a few mistakes slipped through.
I'm interested to hear of any thoughts or concerns in case I'm overlooking any side effects or need to consider organizational implications of such a large change (in terms of number of files touched).
Beta Was this translation helpful? Give feedback.
All reactions