{"action":"created","issue":{"url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5154","repository_url":"https://api.github.com/repos/rubocop-hq/rubocop","labels_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5154/labels{/name}","comments_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5154/comments","events_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5154/events","html_url":"https://github.com/rubocop-hq/rubocop/issues/5154","id":277335782,"node_id":"MDU6SXNzdWUyNzczMzU3ODI=","number":5154,"title":"[New cop] Check indentation of method chained multi-line block","user":{"login":"pocke","id":4361134,"node_id":"MDQ6VXNlcjQzNjExMzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4361134?v=4","gravatar_id":"","url":"https://api.github.com/users/pocke","html_url":"https://github.com/pocke","followers_url":"https://api.github.com/users/pocke/followers","following_url":"https://api.github.com/users/pocke/following{/other_user}","gists_url":"https://api.github.com/users/pocke/gists{/gist_id}","starred_url":"https://api.github.com/users/pocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocke/subscriptions","organizations_url":"https://api.github.com/users/pocke/orgs","repos_url":"https://api.github.com/users/pocke/repos","events_url":"https://api.github.com/users/pocke/events{/privacy}","received_events_url":"https://api.github.com/users/pocke/received_events","type":"User","site_admin":false},"labels":[{"id":95437098,"node_id":"MDU6TGFiZWw5NTQzNzA5OA==","url":"https://api.github.com/repos/rubocop-hq/rubocop/labels/feature%20request","name":"feature request","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-11-28T10:39:45Z","updated_at":"2018-07-04T18:50:38Z","closed_at":null,"author_association":"MEMBER","body":"I think there are three styles to write method chained multi-line block.\r\n\r\n```ruby\r\n# 1st - The indentation base is `.group_by`'s line.\r\nfoobar\r\n  .select { |v| something(v) }.reject { |v| something(v) }\r\n  .group_by { something }.each do |v|\r\n    v.do_something(x)\r\n  end\r\n\r\n# 2nd - The indentation base for the block body is `.group_by`'s line,\r\n#       and the indentation base for the `end` is `foobar`.\r\nfoobar\r\n  .select { |v| something(v) }.reject { |v| something(v) }\r\n  .group_by { something }.each do |v|\r\n    v.do_something(x)\r\nend\r\n\r\n# 3rd - The indentation base is `foobar`.\r\nfoobar\r\n  .select { |v| something(v) }.reject { |v| something(v) }\r\n  .group_by { something }.each do |v|\r\n  v.do_something(x)\r\nend\r\n```\r\n\r\nCurrently, RuboCop only warns 2nd style.\r\n\r\n```bash\r\n$ rubocop \r\nInspecting 1 file\r\nC\r\n\r\nOffenses:\r\n\r\ntest.rb:13:1: C: Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.\r\n    v.do_something(x)\r\n^^^^\r\n\r\n1 file inspected, 1 offense detected\r\n```\r\n\r\n--------\r\n\r\n## Expected behavior\r\n\r\n\r\nI think 1st (or 2nd) style is better. So, If the others styles exist, a new cop should complain.\r\nAnd maybe the styles should be configurable with `EnforcedStyle`.\r\n\r\n\r\n\r\n## RuboCop version\r\n\r\nmaster\r\n\r\n```\r\n$ rubocop -V\r\n0.51.0 (using Parser 2.4.0.2, running on ruby 2.4.2 x86_64-linux)\r\n```\r\n\r\n\r\nRelated issue (Japanese) https://github.com/rubocop-jp/issues/issues/25"},"comment":{"url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/comments/402542378","html_url":"https://github.com/rubocop-hq/rubocop/issues/5154#issuecomment-402542378","issue_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5154","id":402542378,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjU0MjM3OA==","user":{"login":"selesse","id":563658,"node_id":"MDQ6VXNlcjU2MzY1OA==","avatar_url":"https://avatars2.githubusercontent.com/u/563658?v=4","gravatar_id":"","url":"https://api.github.com/users/selesse","html_url":"https://github.com/selesse","followers_url":"https://api.github.com/users/selesse/followers","following_url":"https://api.github.com/users/selesse/following{/other_user}","gists_url":"https://api.github.com/users/selesse/gists{/gist_id}","starred_url":"https://api.github.com/users/selesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selesse/subscriptions","organizations_url":"https://api.github.com/users/selesse/orgs","repos_url":"https://api.github.com/users/selesse/repos","events_url":"https://api.github.com/users/selesse/events{/privacy}","received_events_url":"https://api.github.com/users/selesse/received_events","type":"User","site_admin":false},"created_at":"2018-07-04T18:50:38Z","updated_at":"2018-07-04T18:50:38Z","author_association":"NONE","body":"+1 for a new cop.\r\n\r\nHas there been any progress on this?"}}
{"actor":{"display_login":"selesse"}}