{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/21997","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/21997/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/21997/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/21997/events","html_url":"https://github.com/nodejs/node/pull/21997","id":345152769,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0Mzc1MjQ5","number":21997,"title":"tools: add `make format-cpp` to run clang-format on C++ diffs","user":{"login":"joyeecheung","id":4299420,"node_id":"MDQ6VXNlcjQyOTk0MjA=","avatar_url":"https://avatars0.githubusercontent.com/u/4299420?v=4","gravatar_id":"","url":"https://api.github.com/users/joyeecheung","html_url":"https://github.com/joyeecheung","followers_url":"https://api.github.com/users/joyeecheung/followers","following_url":"https://api.github.com/users/joyeecheung/following{/other_user}","gists_url":"https://api.github.com/users/joyeecheung/gists{/gist_id}","starred_url":"https://api.github.com/users/joyeecheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joyeecheung/subscriptions","organizations_url":"https://api.github.com/users/joyeecheung/orgs","repos_url":"https://api.github.com/users/joyeecheung/repos","events_url":"https://api.github.com/users/joyeecheung/events{/privacy}","received_events_url":"https://api.github.com/users/joyeecheung/received_events","type":"User","site_admin":false},"labels":[{"id":171787391,"node_id":"MDU6TGFiZWwxNzE3ODczOTE=","url":"https://api.github.com/repos/nodejs/node/labels/build","name":"build","color":"eb6420","default":false},{"id":191447057,"node_id":"MDU6TGFiZWwxOTE0NDcwNTc=","url":"https://api.github.com/repos/nodejs/node/labels/meta","name":"meta","color":"fef2c0","default":false},{"id":237979054,"node_id":"MDU6TGFiZWwyMzc5NzkwNTQ=","url":"https://api.github.com/repos/nodejs/node/labels/tools","name":"tools","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-07-27T09:18:36Z","updated_at":"2018-08-03T11:40:57Z","closed_at":"2018-08-03T11:40:57Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/21997","html_url":"https://github.com/nodejs/node/pull/21997","diff_url":"https://github.com/nodejs/node/pull/21997.diff","patch_url":"https://github.com/nodejs/node/pull/21997.patch"},"body":"This is a rework of https://github.com/nodejs/node/pull/16122. I took the advice from @codebytere and make clang-format run on C++ diffs instead of the whole code base (this is also what chromium's git-cl does). This allows us to gradually format the code base while we update the C++ files in normal PRs (although it may require support from external tooling and build to make sure people run it before landing PRs).\r\n\r\nThere is currently only a shortcut in Makefile. To run it on Windows one will either need to start the command manually or refactor vcbuild.bat a bit to include/exclude the formatable C++ files in the command.\r\n\r\nOne thing to note: the clang-format npm package is maintained by the Angular team. It directly downloads executables hosted in their repository: https://github.com/angular/clang-format It seems to be reasonably safe to use. Otherwise we will have to build and host a bunch of executables for different platforms ourselves because different versions of clang-format may format the files differently so we would want to keep the version fixed.\r\n\r\n------ patch description ----\r\n\r\nThis patch adds a `make format-cpp` shortcut to the Makefile\r\nthat runs clang-format on the C++ diffs, and a\r\n`make format-cpp-build` to install clang-format from\r\nnpm.\r\n\r\nTo format staged changes:\r\n\r\n```\r\n$ make format-cpp\r\n```\r\n\r\nTo format HEAD~1...HEAD (latest commit):\r\n\r\n```\r\n$ CLANG_FORMAT_START=`git rev-parse HEAD~1` make format-cpp\r\n```\r\n\r\nTo format diff between master and current branch head (master...HEAD):\r\n\r\n```\r\n$ CLANG_FORMAT_START=master make format-cpp\r\n```\r\n\r\nMost of the .clang-format file comes from running\r\n\r\n```\r\n$ clang-format --dump-config --style=Google\r\n```\r\n\r\nwith clang-format built with llvm/trunk 328768 (npm version 1.2.3)\r\n\r\nThe clang-format version is fixed because different version of\r\nclang-format may format the files differently.\r\n\r\n<!--\r\nThank you for your pull request. Please provide a description above and review\r\nthe requirements below.\r\n\r\nBug fixes and new features should include tests and possibly benchmarks.\r\n\r\nContributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n##### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes\r\n- [x] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/410228520","html_url":"https://github.com/nodejs/node/pull/21997#issuecomment-410228520","issue_url":"https://api.github.com/repos/nodejs/node/issues/21997","id":410228520,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDIyODUyMA==","user":{"login":"joyeecheung","id":4299420,"node_id":"MDQ6VXNlcjQyOTk0MjA=","avatar_url":"https://avatars0.githubusercontent.com/u/4299420?v=4","gravatar_id":"","url":"https://api.github.com/users/joyeecheung","html_url":"https://github.com/joyeecheung","followers_url":"https://api.github.com/users/joyeecheung/followers","following_url":"https://api.github.com/users/joyeecheung/following{/other_user}","gists_url":"https://api.github.com/users/joyeecheung/gists{/gist_id}","starred_url":"https://api.github.com/users/joyeecheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joyeecheung/subscriptions","organizations_url":"https://api.github.com/users/joyeecheung/orgs","repos_url":"https://api.github.com/users/joyeecheung/repos","events_url":"https://api.github.com/users/joyeecheung/events{/privacy}","received_events_url":"https://api.github.com/users/joyeecheung/received_events","type":"User","site_admin":false},"created_at":"2018-08-03T11:40:57Z","updated_at":"2018-08-03T11:40:57Z","author_association":"MEMBER","body":"The last CI was green. Landed in Landed in 0da144f, thanks!"}}
{"actor":{"display_login":"joyeecheung"}}