[wp-trac] [WordPress Trac] #47411: Build tools, WPCS: disable line ending check

WordPress Trac noreply at wordpress.org
Sat Sep 14 22:38:53 UTC 2019


#47411: Build tools, WPCS: disable line ending check
------------------------------+-------------------------------
 Reporter:  azaozz            |       Owner:  azaozz
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:  5.3
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  2nd-opinion       |     Focuses:  coding-standards
------------------------------+-------------------------------

Comment (by azaozz):

 Replying to [comment:9 jrf]:

 It's not as simple :) Lets summarize.

 WP supports both git and svn. In the git case:
 - With the default git settings line endings are controlled automatically.
 It is not advisable to change the defaults unless all contributors to a
 particular repository change their settings. In addition these are
 "global" settings in git so requiring a contributor to change them for one
 project is not a good idea.
 - With the default git settings line endings are automatically converted
 to match the local env. Preemptive line ending checks are redundant. This
 also means WPCS checking line endings is incompatible with the git default
 setting on Windows (unless it is set to check for `\r\n`).

 For svn:
 - This is somewhat more involved as @SergeyBiryukov mentions above. "Line
 endings style" is a property of each file there. That property is
 committed to the repository. Changing the property will invalidate all
 existing patches, and may cause regressions like bringing back #3264.
 - Similarly to git svn automatically sets the line endings style depending
 on local env. That, again, makes the line endings check in WPCS redundant
 and incompatible with Windows. In addition svn will throw an error on
 commit (and block the commit) if line endings are different style, i.e.
 some are `\r\n` some are `\n`.

 > The `phpcs.xml.dist` file are the project rules and should not be
 changed for something like this.

 I don't understand what this means. There is a buggy rule that doesn't
 work properly, and that can be fixed by changing the settings. Should the
 WordPress project ignore the bug and continue to use the buggy rule?

 > However, if an individual dev wants to locally ignore certain issues...

 This bug affects all contributors that use Windows. If we want to use an
 exception it should be added to core.

 At this point I'm starting to wonder why WPCS is checking line endings at
 all? Do we expect git and svn to be buggy and fail? How was this handled
 before the had WPCS sniffs, were there any "line endings accidents"?

 I don't mind reverting the commit, but I'd rather remove the line endings
 check from WPCS as it is:
 1. Buggy. Doesn't work on Windows.
 2. Not needed. Line endings are handled better by git/svn.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47411#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list