{"action":"created","issue":{"url":"https://api.github.com/repos/baidu/Paddle/issues/422","repository_url":"https://api.github.com/repos/baidu/Paddle","labels_url":"https://api.github.com/repos/baidu/Paddle/issues/422/labels{/name}","comments_url":"https://api.github.com/repos/baidu/Paddle/issues/422/comments","events_url":"https://api.github.com/repos/baidu/Paddle/issues/422/events","html_url":"https://github.com/baidu/Paddle/pull/422","id":188445988,"number":422,"title":"use yapf to format python code, add style config file","user":{"login":"QiJune","id":22017000,"avatar_url":"https://avatars.githubusercontent.com/u/22017000?v=3","gravatar_id":"","url":"https://api.github.com/users/QiJune","html_url":"https://github.com/QiJune","followers_url":"https://api.github.com/users/QiJune/followers","following_url":"https://api.github.com/users/QiJune/following{/other_user}","gists_url":"https://api.github.com/users/QiJune/gists{/gist_id}","starred_url":"https://api.github.com/users/QiJune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QiJune/subscriptions","organizations_url":"https://api.github.com/users/QiJune/orgs","repos_url":"https://api.github.com/users/QiJune/repos","events_url":"https://api.github.com/users/QiJune/events{/privacy}","received_events_url":"https://api.github.com/users/QiJune/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-11-10T08:19:12Z","updated_at":"2016-11-10T11:16:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/baidu/Paddle/pulls/422","html_url":"https://github.com/baidu/Paddle/pull/422","diff_url":"https://github.com/baidu/Paddle/pull/422.diff","patch_url":"https://github.com/baidu/Paddle/pull/422.patch"},"body":"1 use yapf  ( https://github.com/google/yapf)   to format python code, and add .style.yapf config file #254 \r\n2 contributors can add a git hooks to auto-format changed python code just like this\r\n```\r\ncat .git/hooks/pre-commit\r\n```\r\n\r\n```\r\n#!/bin/bash\r\n\r\nfunction python_style_check() {\r\n    #check python code in a git repo\r\n    root=`git rev-parse --show-toplevel`\r\n    exit=0\r\n    for file in `git diff --staged --name-only|grep '\\.py$'`; do\r\n        yapf -i --style=$root/.style.yapf $root/$file        \r\n        if [ $? -ne 0 ]; then\r\n            let exit=1\r\n        fi\r\n        git add $root/$file\r\n    done\r\n    exit $exit\r\n}\r\npython_style_check\r\n```"},"comment":{"url":"https://api.github.com/repos/baidu/Paddle/issues/comments/259664934","html_url":"https://github.com/baidu/Paddle/pull/422#issuecomment-259664934","issue_url":"https://api.github.com/repos/baidu/Paddle/issues/422","id":259664934,"user":{"login":"backyes","id":920727,"avatar_url":"https://avatars.githubusercontent.com/u/920727?v=3","gravatar_id":"","url":"https://api.github.com/users/backyes","html_url":"https://github.com/backyes","followers_url":"https://api.github.com/users/backyes/followers","following_url":"https://api.github.com/users/backyes/following{/other_user}","gists_url":"https://api.github.com/users/backyes/gists{/gist_id}","starred_url":"https://api.github.com/users/backyes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/backyes/subscriptions","organizations_url":"https://api.github.com/users/backyes/orgs","repos_url":"https://api.github.com/users/backyes/repos","events_url":"https://api.github.com/users/backyes/events{/privacy}","received_events_url":"https://api.github.com/users/backyes/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T11:16:17Z","updated_at":"2016-11-10T11:16:17Z","body":"@QiJune 能否做成make的时候自动格式化呢？ 现在毕竟还是需要用户自己添加git hook。"}}
{"actor":{"display_login":"backyes"}}