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

WordPress Trac noreply at wordpress.org
Tue May 28 17:09:17 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:5 johnbillion]:
 > ...globally overriding one of core's coding standards

 Line endings, i.e. `\r\n` vs. `\n` have never been part of the coding
 standards and as far as I see are not part of any (popular) coding
 standard. I don't mind enforcing either one or the other but that would
 mean forcing all people that want to contribute something to change their
 (global) git or svn configuration.

 > This change prevents "real" line ending issues from being discovered
 during code sniffing.

 Not sure what "real" line ending issues are. The facts are that doing `svn
 co` or `git clone` on Windows changes all line endings in all files to
 `\r\n`. Then running `phpcs` triggers errors/warnings for each file in
 WordPress.

 I know, I've taken it upon myself to still (try to) develop on Windows
 when pretty much "everybody" is on Mac or Linux. This is exactly to be
 able to spot and fix this kind of issues (and of course to be able to
 easily test in the Windows browsers). BTW there are some unit tests that
 fail because `\n` line endings are hard-coded in the source, see #46798.
 Going to fix that next :)

 To answer your questions:
 > * Does this rule need to be fixed upstream in WPCS?

 No, it is not part of WPCS.

 > * Is there a lower level issue with PHPCS?

 It is not an issue. It is a (configurable) setting.

 > * Is this an issue with the local Git/SVN configuration?

 No. The global (default) configuration handles line endings in both Git
 and SVN.

 > * How does every other project that uses PHPCS handle this problem?

 Not sure. There are probably thousands of projects that use PHPCS :)

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


More information about the wp-trac mailing list