{"action":"created","issue":{"url":"https://api.github.com/repos/mako-framework/framework/issues/130","labels_url":"https://api.github.com/repos/mako-framework/framework/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/mako-framework/framework/issues/130/comments","events_url":"https://api.github.com/repos/mako-framework/framework/issues/130/events","html_url":"https://github.com/mako-framework/framework/issues/130","id":55842265,"number":130,"title":"Trailing whitespace","user":{"login":"telephone","id":1809542,"avatar_url":"https://avatars.githubusercontent.com/u/1809542?v=3","gravatar_id":"","url":"https://api.github.com/users/telephone","html_url":"https://github.com/telephone","followers_url":"https://api.github.com/users/telephone/followers","following_url":"https://api.github.com/users/telephone/following{/other_user}","gists_url":"https://api.github.com/users/telephone/gists{/gist_id}","starred_url":"https://api.github.com/users/telephone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telephone/subscriptions","organizations_url":"https://api.github.com/users/telephone/orgs","repos_url":"https://api.github.com/users/telephone/repos","events_url":"https://api.github.com/users/telephone/events{/privacy}","received_events_url":"https://api.github.com/users/telephone/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-29T01:18:56Z","updated_at":"2015-01-29T12:44:26Z","closed_at":null,"body":"This ones more of a pet peeve, but I've noticed across all the projects (framework, app, and toolbar) there's a lot of trailing whitespace leftover from the IDE/editor.\r\n\r\nIn `mako-framework/framework` alone, there's 248 PHP files with trailing whitespace.\r\n\r\n__Example:__\r\n\r\n![mako-whitespace2](https://cloud.githubusercontent.com/assets/1809542/5949305/28b3fcec-a7b1-11e4-999c-ebedb27a739b.png)\r\n\r\n__Temporary Solution:__\r\n\r\nUse [PHP-CS-FIXER](http://cs.sensiolabs.org) to remove trailing whitespace:\r\n\r\n```\r\n1) curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar\r\n2) php php-cs-fixer.phar fix src/mako --fixers=trailing_spaces,whitespacy_lines\r\n\r\nOptional:\r\n- Add --dry-run to #2 to view filenames that need fixing\r\n- Add --dry-run --diff to #2 to output a diff of the changes (best to output to file)\r\n```\r\n\r\n__Permanent Solutions:__\r\n\r\n1) Include an [.editorconfig](http://editorconfig.org) file in the repo's root to ensure coding standards are in-sync. (Note: You'll still have to apply the temporary solution)\r\n\r\nHere's an example that would work for mako:\r\n```\r\n# top-most EditorConfig file\r\nroot = true\r\n\r\n# Only apply to PHP files:\r\n# UTF-8, Unix line endings, Tab indention (1 tab = 4 spaces), Trim trailing whitespace on save\r\n[*.php]\r\ncharset = utf-8\r\nend_of_line = lf\r\nindent_style = tab\r\ntab_width = 4\r\ntrim_trailing_whitespace = true\r\n```\r\n2) Run [PHP-CS-FIXER](http://cs.sensiolabs.org) before each release. While this option doesn't stay on-top of the issue, it at least allows each release to have a clean slate.\r\n\r\n3) Write a pre-commit hook for git that will run [PHP-CS-FIXER](http://cs.sensiolabs.org) with the designated coding standards. I can easily code one up if needed...\r\n\r\n4) Enable `Strip trailing spaces on Save` for your given editor. (Note: You'll still have to apply the temporary solution).\r\n\r\n---\r\n\r\nAt the end of the day, it comes down to the developers preferences... And I'm a bit of a whitespace-natzi when it comes to PHP :neckbeard:.  \r\nPersonally I've used all the options above for different projects, but [.editorconfig](http://editorconfig.org) is usually the easiest as it's available as a plugin for almost every IDE/editor."},"comment":{"url":"https://api.github.com/repos/mako-framework/framework/issues/comments/72018107","html_url":"https://github.com/mako-framework/framework/issues/130#issuecomment-72018107","issue_url":"https://api.github.com/repos/mako-framework/framework/issues/130","id":72018107,"user":{"login":"freost","id":773958,"avatar_url":"https://avatars.githubusercontent.com/u/773958?v=3","gravatar_id":"","url":"https://api.github.com/users/freost","html_url":"https://github.com/freost","followers_url":"https://api.github.com/users/freost/followers","following_url":"https://api.github.com/users/freost/following{/other_user}","gists_url":"https://api.github.com/users/freost/gists{/gist_id}","starred_url":"https://api.github.com/users/freost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freost/subscriptions","organizations_url":"https://api.github.com/users/freost/orgs","repos_url":"https://api.github.com/users/freost/repos","events_url":"https://api.github.com/users/freost/events{/privacy}","received_events_url":"https://api.github.com/users/freost/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T12:44:26Z","updated_at":"2015-01-29T12:44:26Z","body":"I have no problems with getting rid of all trailing whitespace :stuck_out_tongue: \r\n\r\nI made a couple of commits where I removed all of it using the php-cs-fixer and I have also added a .editconfig file. (I'll do the same of the the skeleton app and the toolbar).\r\n\r\nI'll look into adding pre-commit hook. Wouldn't it require people to have php-cs-fixer installer?"}}