Since a few folks do not believe that a dedicated time-frame for doing major code/documentation clean-ups in a Drupal core release cycle won't work out and will not happen, I'm starting with a first patch now.
This patch is just for actions.inc. It does not alter its functionality. It just fixes documentation and coding-style issues according to our current standards. Actually a no-brainer for webchick, I guess.
Depending on the amount of follow-ups on this issue until the patch has been committed, I'd like to post follow-up patches for all other files in core in this issue (one file per patch) - hence, the issue title. So please try to keep this issue clean - thanks. Any discussions about our current coding standards should (must) happen in another issue, not here.
» Jump to current file
.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | drupal.cleanup-batch.patch | 18.37 KB | sun |
| #8 | drupal.cleanup-batch.patch | 16.9 KB | sun |
| #9 | drupal.cleanup-batch.patch | 17.09 KB | sun |
| #6 | drupal.cleanup-actions.patch | 8.63 KB | sun |
| #5 | drupal.cleanup-actions.patch | 9.49 KB | sun |
Comments
Comment #1
cburschkaI've looked over that and it seems okay (I didn't know about the below convention, but I figure it's correct).
Patch passes too.
Comment #3
maartenvg commentedNeeds retesting due to #335122: Test clean HEAD after every commit.
Comment #4
sunTo test again.
Comment #5
sunChanged indents of DBTNG methods.
Comment #6
sunRemoved changes to DBTNG queries.
Also, re-stating my original question:
Depending on the amount of follow-ups on this issue until the patch has been committed, I'd like to post follow-up patches for all other files in core in this issue (one file per patch) - hence, the issue title.
Opening and keeping track of gazillions of single "code clean-up" issues would stress me, so I hope the proposed procedure is okay?
Comment #7
webchickCool. I've committed this. Nice clean-up! Setting back to active now for the next file.
I asked sun to remove the DBTNG hunks because we kind of have a standard (mostly from Crell asking me "what do you think about x vs. y" periodically over the course of the past 3 months) that these changes would break. I agree this standard could likely be improved, and it must certainly be documented. Let's follow-up on the coding standards group on g.d.o and hash this out, then make a series of code clean-up patches that make all DBTNG conform to this standard, whatever it ends up being.
Comment #8
sunI had hard times understanding the code there and even needed to correct a bunch of comments to reflect the actual code.
Comment #9
sun/me should review own patches before submitting.
Comment #10
webchickThis is good stuff and makes batch.inc fairly legible, which is awesome considering I don't know anyone but yched who knows this stuff very well currently. :)
We should avoid the use of gendered pronouns (male or female). See #75594: Removal of gender-specific pronouns from core. Perhaps something like, "If no JavaScript-enabled page has been visited during the current user's browser session, the non-JavaScript version is returned."
That is a very very very VERY long sentence. :) Can you chuck a period in there somewhere?
That is 88 chars. Needs to be shortened up (sun suggested dropping "in the database" which sounds fine to me).
Comment #11
yched commentedThks sun. I *really* tried to make things as clear as I could, but batch.inc *is* complex indeed, and maybe my english came short too.
Some info is lost here. The point is that a batched processing may contain several independent 'sets of operations' (if several calls to batch_set() have been made, e.g in diferent submit handlers for a form, or if a batched op itself does a batch_set() - rare, but might happen). Those 'sets' are processed sequentially.
In JS mode, the batch process page is displayed only once and updated through AHAH requests, so only the first set gets to define the page title. Titles specified by the subsequent set are not displayed.
Maybe we need to remove that now that #242873: make drupal_set_title() use check_plain() by default. got in ?
Incorrect. Progressive mode is : execute as many ops as you can until you exceeded 1 second processing time, then break and report.progress.
I'm not sure the 'batch phase' terminology is a good thing.
The singular should be kept - only 1 operation is removed.
New version is less accurate. We don't walk through *all* sets, we walk through sets until we find one with real operations.
"executes any form_submit callbacks in subsequent sets" is ambiguous; I understand : "it executes them in subsequent sets", which has no meaning.
"Submit handler" vs "submit callback" : unless I'm mistaken, FAPI uses the term "submit handler".
That's a different task, but the file registry should now let us get rid of the $batch['file'] thing.
Comment #12
sunThanks for reviewing and clarifying. Attached patch should eliminate all issues mentioned in #10 and #11. I used some of yched's clarifications almost literally, because they (thankfully) describe what's actually going on and how that code is supposed to work. :)
The batch title safety issue should be discussed in a separate issue. The current code properly uses PASS_THROUGH. However, I have moved the completely misplaced note about this into the PHPdoc for batch_set() (in form.inc).
Comment #13
sunI think the patch for batch.inc is actually RTBC.
Comment #14
webchickVery nice. :) Committed batch.inc code clean-up to HEAD.
(bolding so it's easier to pick out in a quick scan.)
Marking back to active. :)
Comment #15
drewish commentedsubscribing.
Comment #16
sunCleaning up core makes no sense at all, because each committed patch adds new badness. Furthermore, the way some people think they could redefine Drupal's coding standards into complete nonsense will, without any doubt, fail.