Triggered by #850152: Use "elseif" in place of "else if",

externally developed files like the Archive_Tar class in system.tar.inc (CVS log) should not be changed to match our coding standards, as we likely want to update them in the future. Always, bugs should be properly fixed upstream.

I recommend to

  1. Revert all style-only changes to the original revision of system.tar.inc. Only keep changes required for Drupal integration.
  2. All required changes also require an inline comment to help evaluate file differences in the future.
  3. We want to remove "$" around external CVS keywords, so they are not replaced with our values.

According to the second file revision, it seems like the original, external revision in PEAR was 1.43.

chx provided a diff for the changes required for Drupal integration in the original issue, #486558: Add Archive Tar to Drupal

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klonos’s picture

subscribing...

Damien Tournoud’s picture

I made a similar point in #861566-4: Use uppercase for PHP constants, e.g. NULL, TRUE, FALSE, now closed in favor of this one.

sun’s picture

kiamlaluno prepared some patches in http://drupal.org/node/850152#comment-3270728 already, but I'm not sure whether they are based on the correct original revision we committed. He mentioned 1.2, but our log says 1.43.

dhthwy’s picture

+1

I totally agree with sun and Damien.

webchick’s picture

Agreed.

And then, can folks who care about code consistency please spend time on some kind of fancy Drush / Coder integration for "drush coder-format --fixelseif --fixnewlines" and whatnot that's smart about exempting this sort of upstream code, and which maintainers can then run at their leisure, rather than wasting a bunch of actual human brains on this problem every couple of months?

Damien Tournoud’s picture

@webchick: to be honest, I'm slightly tired of reviewers rejecting patches for trailing new lines and stuff like that.

sun’s picture

I actually suspect that the current flood of coding style clean-up patches has been done manually via grep/search/replace, without Coder, resp., the coder_format script.

But anyway, recently thought about Drush integration for coder_format too. Would be nice indeed, but I'm out of the loop where current efforts of that other code parser/rewriter (PGP?) stand. Don't want to waste time (although "it works", of course...)

webchick’s picture

Damien: Me too. If we had drush coder-format --fix-whitespace, core committers could just run that prior to committing any patches, and we'd fix them at commit time (or, failing that, at release time). I'm 100% in favour of not wasting human brains on whitespace issues.

webchick’s picture

sun: I know, which makes it even worse because someone had to manually craft those, and someone else had to review them one. line. at a time. So heart-breaking. :(

I'm not sure where Coder's at atm, but solotandem would be a good person to ping on IRC.

apaderno’s picture

The patches I proposes are based on the last commits done to the file, right after my previous patch in #850152: Use "elseif" in place of "else if" was applied. I was referring to revision 1.2 (the revision of the file system.tar.inc, not the original one) as the revision to which revert the file content.

apaderno’s picture

Status: Active » Needs review
FileSize
35.52 KB

I attach here the patch that would revert the file back to revision 1.2, which is the revision without any style changes. It's not the first revision of the file, though.

aspilicious’s picture

totally off topic
--------------

To all:

I'm not a git expert, but I read that there are some git options to adjust a file while getting updated with some kind of script that can replace tabs with spaces, add newlines, ...
99% of our patches could use such a script. 1% sadly need "/no newline at end of file" or other "errors" (for testing purpose, or for other causes).

If we transfer to git it maybe would be an idea to add a checkbox somewhere around the upload patch button which says: "check and convert to our coding standards".
That way me or someone else don't have to nitpick any more (I hate it to).

ps: optional we could let the uploader now what was wrong in his patch so he could learn some coding standards in a more automated way.

on topic
--------
let's review 11

sun’s picture

Looks good to me, but let's additionally ensure bullet points 2 + 3 of the OP.

apaderno’s picture

I looked at the original report opened by chx, and I noticed that he changed the code to decouple it from PEAR.
In that case, what is the difference if the code has been changed to fit our coding standards? If we need to update the code to the latest code developed for the original file, we still need to change the code to decouple it from PEAR.

webchick’s picture

Status: Needs review » Needs work

On aspilicious's OT remark, I'm fine with teaching people coding standards. I am NOT okay with human coders/reviewers wasting braincells on trailing whitespace and extra newlines at the end of files. Let computers worry about that.

Back on-topic, this is needs work, per #13.

apaderno’s picture

Which kind of changes should be commented? Shall we comment all the changes, including the ones done to decouple the code from PEAR?

apaderno’s picture

The attached patch documents the changes done from our revision 1.1 to 1.2; it also avoid the original CVS tags are replaced by removing the $ at the beginning, and end of the orginal CVS tags.

I will submit a different patch that contains the code removed from the original file as comments.

sun’s picture

yes, basically all customizations, so everyone is able to compare a newer version of Archive_Tar to ours and tell which upstream changes need to be taken over.

There are two ways to do this,

a) using a common comment for all, i.e., // Drupal integration.

b) commenting out the original line, i.e., keeping it right in front of the customization.

apaderno’s picture

Status: Needs work » Needs review
FileSize
37.87 KB

I took the approach taken in the back port of SimpleTest for Drupal 6.

apaderno’s picture

FileSize
37.94 KB

I added the comment // Drupal integration. in two places.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, I think this is good to go.

I'll additionally point Dries to this issue, so he also doesn't commit such coding style patches in the future.

sun’s picture

Reconsidered: Let's make him simply commit this patch.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pillarsdotnet’s picture