{"action":"created","issue":{"url":"https://api.github.com/repos/PX4/Firmware/issues/5370","repository_url":"https://api.github.com/repos/PX4/Firmware","labels_url":"https://api.github.com/repos/PX4/Firmware/issues/5370/labels{/name}","comments_url":"https://api.github.com/repos/PX4/Firmware/issues/5370/comments","events_url":"https://api.github.com/repos/PX4/Firmware/issues/5370/events","html_url":"https://github.com/PX4/Firmware/pull/5370","id":172797549,"number":5370,"title":"Proposal to check code style a bit earlier","user":{"login":"AndreasAntener","id":5750020,"avatar_url":"https://avatars.githubusercontent.com/u/5750020?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreasAntener","html_url":"https://github.com/AndreasAntener","followers_url":"https://api.github.com/users/AndreasAntener/followers","following_url":"https://api.github.com/users/AndreasAntener/following{/other_user}","gists_url":"https://api.github.com/users/AndreasAntener/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreasAntener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreasAntener/subscriptions","organizations_url":"https://api.github.com/users/AndreasAntener/orgs","repos_url":"https://api.github.com/users/AndreasAntener/repos","events_url":"https://api.github.com/users/AndreasAntener/events{/privacy}","received_events_url":"https://api.github.com/users/AndreasAntener/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PX4/Firmware/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-23T20:25:05Z","updated_at":"2016-08-23T20:56:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PX4/Firmware/pulls/5370","html_url":"https://github.com/PX4/Firmware/pull/5370","diff_url":"https://github.com/PX4/Firmware/pull/5370.diff","patch_url":"https://github.com/PX4/Firmware/pull/5370.patch"},"body":"I've separated the list of included modules to check code style so everyone can include it in their git pre-commit hook and run it for changed files only before the commit. This should get rid of these unnecessary \"code style\" commits at the end of a pull request.\r\n\r\nHad to remove `-print0` from find, which should be fine as long as we don't have spaces in the paths.. Maybe a linux guru can suggest a way to keep `-print0` (and test this :)).\r\n\r\nOnce this is good I can followup with a quick doc in the devguide.\r\n\r\nHow-to, in your repositories:\r\n```\r\nmv .git/hooks/pre-commit.sample .git/hooks/pre-commit\r\nchmod 755 .git/hooks/pre-commit\r\n```\r\n\r\nThen edit `.git/hooks/pre-commit` and replace the white-space check (yes, it also does that 👍 ) at the end to:\r\n```\r\n# If there are whitespace errors, print the offending file names and fail.\r\ngit diff-index --check --cached $against --\r\nif [ $? -ne 0 ]\r\nthen\r\n        exit 1\r\nfi\r\n\r\n# Check for code style, only in changed files\r\nfor i in `git diff --cached --name-only --diff-filter=ACM`\r\ndo\r\n        ./Tools/files_to_check_code_style.sh $i | xargs -n 1 -P 8 -I % ./Tools/check_code_style.sh %\r\n        if [ $? -ne 0 ]\r\n        then\r\n                exit 1\r\n        fi\r\ndone\r\n```\r\n\r\n(see my complete pre-commit file: https://gist.github.com/AndreasAntener/0f9cc67cd4d4eb321f935297d9c268bd)"},"comment":{"url":"https://api.github.com/repos/PX4/Firmware/issues/comments/241875697","html_url":"https://github.com/PX4/Firmware/pull/5370#issuecomment-241875697","issue_url":"https://api.github.com/repos/PX4/Firmware/issues/5370","id":241875697,"user":{"login":"AndreasAntener","id":5750020,"avatar_url":"https://avatars.githubusercontent.com/u/5750020?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreasAntener","html_url":"https://github.com/AndreasAntener","followers_url":"https://api.github.com/users/AndreasAntener/followers","following_url":"https://api.github.com/users/AndreasAntener/following{/other_user}","gists_url":"https://api.github.com/users/AndreasAntener/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreasAntener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreasAntener/subscriptions","organizations_url":"https://api.github.com/users/AndreasAntener/orgs","repos_url":"https://api.github.com/users/AndreasAntener/repos","events_url":"https://api.github.com/users/AndreasAntener/events{/privacy}","received_events_url":"https://api.github.com/users/AndreasAntener/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T20:56:23Z","updated_at":"2016-08-23T20:56:23Z","body":"Sorry I was also blind it seems...\r\nI like your fancy idea :). A good start could be to let `check_code_style_all.sh` do that?"}}
{"actor":{"display_login":"AndreasAntener"}}