Mikie Posted February 15, 2020 Share Posted February 15, 2020 I think the ProcessWire style guide should move to recommending stripping trailing whitespace, and this should be implemented throughout core / recommened for all modules. This would be inline with official php style guides, eg https://www.php-fig.org/psr/psr-12/ Just a thought. To me it is better to keep things cleaner than not. Would make diffing easier for those whose editors automatically highlight and strip whitespace on save, eg when trying to diff htaccess.txt and an edited .htaccess. 3 Link to comment Share on other sites More sharing options...
adrian Posted February 16, 2020 Share Posted February 16, 2020 I completely agree - I always have my editor set to remove all trailing whitespace on save. It makes diffs so much easier to read/interpret because you don't end up with all the whitespace changes that can happen. Unfortunately this has been discussed before and Ryan actually said "I find a space at the end of lines helpful in my editing environment" (https://github.com/ryancramerdesign/ProcessWire/issues/1757). I don't understand why, but it sounds like he doesn't want to change this, although of course that discussion was some time ago. 2 Link to comment Share on other sites More sharing options...
Mikie Posted February 16, 2020 Author Share Posted February 16, 2020 Thanks for that @adrian. I thought it might specifically be part of the current styleguide for a reason. Understandable if Ryan works that way, we all want him to be as productive as possible! 1 Link to comment Share on other sites More sharing options...
dragan Posted February 16, 2020 Share Posted February 16, 2020 I agree too that this should be added to the styleguide, and I also configured my IDE to strip trailing whitespace on save. However, if we're talking about diff tools, it's just as easy to configure them to ignore whitespace (and even empty lines). PHPStorm Git has the option --ignore-whitespace you can use. VSCode: File => Preferences => Settings => Diff Editor => Ignore Trim Whitespace. 2 Link to comment Share on other sites More sharing options...
Mikie Posted February 16, 2020 Author Share Posted February 16, 2020 7 hours ago, dragan said: However, if we're talking about diff tools, it's just as easy to configure them to ignore whitespace (and even empty lines). Yeah I didnt even know about this until the replies here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now