You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Generic.Files.LineEndings rule is incompatible with Subversion in the WordPress Core repository.
What did you expect to happen? What actually happened?
Expected: WPCS and SVN work well together.
Actual: The above rule enforces \n line endings in PHP files on Windows. However SVN enforces \r\n line endings as the WP Core files have svn:eol-style = native property. This results in redundant errors being reported and useless changes being made to all files when PHPCS/PHPCBF and SVN take over one another.
In addition there is no rule about line endings in the WordPress PHP Coding Standards. Line endings "management" is left for the version control systems, Subversion and/or Git. The Generic.Files.LineEndings should not be in the WPCS sniffs.
Tested Against develop branch?
I have verified the issue still exists in the develop branch of WPCS.
The text was updated successfully, but these errors were encountered:
As I have stated before, different people work in different ways. People may have their local development environment set up in a different way than you have.
This can (and will) result in files having mixed line endings prior to commit depending on the local setup by devs.
If PHPCS - and especially PHPCBF - is run over files with mixed line endings, the results will be unreliable and this may result in incorrect fixes being made.
I am not prepared to offer any kind of support for any questions or bug reports related to this if that rule would get removed.
Aside from the fact that PHPCS will just replace the errors about incorrect line endings from the sniff with errors about files having mixed line endings, which is a PHPCS internal system warning, not based on any sniff.
I've told you before and I will repeat it again now: if you are comfortable with your personal dev environment not being susceptible to the "mixed line endings" issue, you can turn that rule off for your own local environment using a phpcs.xml file with the following content:
Git: Should have a .gitattributes file which effectively sets LF for git checkout. This has been the "new" system for 8 years now. No need for config changes at the local git install level.
SVN: Yes, might be a one-off pain to change the per-file SVN EOL config for WP core files, but it's basically the only one that's allowing CRLF.
Bug Description
Please provide a clear and concise description of what the bug is.
Please see https://core.trac.wordpress.org/ticket/47411#comment:18.
The
Generic.Files.LineEndings
rule is incompatible with Subversion in the WordPress Core repository.What did you expect to happen? What actually happened?
Expected: WPCS and SVN work well together.
Actual: The above rule enforces
\n
line endings in PHP files on Windows. However SVN enforces\r\n
line endings as the WP Core files havesvn:eol-style = native
property. This results in redundant errors being reported and useless changes being made to all files when PHPCS/PHPCBF and SVN take over one another.In addition there is no rule about line endings in the WordPress PHP Coding Standards. Line endings "management" is left for the version control systems, Subversion and/or Git. The
Generic.Files.LineEndings
should not be in the WPCS sniffs.Tested Against
develop
branch?develop
branch of WPCS.The text was updated successfully, but these errors were encountered: