{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/2035","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2035/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2035/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2035/events","html_url":"https://github.com/bbatsov/rubocop/issues/2035","id":94446834,"number":2035,"title":"ExtraSpacing reform","user":{"login":"jonas054","id":336720,"avatar_url":"https://avatars.githubusercontent.com/u/336720?v=3","gravatar_id":"","url":"https://api.github.com/users/jonas054","html_url":"https://github.com/jonas054","followers_url":"https://api.github.com/users/jonas054/followers","following_url":"https://api.github.com/users/jonas054/following{/other_user}","gists_url":"https://api.github.com/users/jonas054/gists{/gist_id}","starred_url":"https://api.github.com/users/jonas054/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonas054/subscriptions","organizations_url":"https://api.github.com/users/jonas054/orgs","repos_url":"https://api.github.com/users/jonas054/repos","events_url":"https://api.github.com/users/jonas054/events{/privacy}","received_events_url":"https://api.github.com/users/jonas054/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-11T07:02:12Z","updated_at":"2015-07-11T19:16:45Z","closed_at":null,"body":"Based on @jacob-carlborg's question about detecting alignment in #1888, I have a suggestion for how we can change `Style/ExtraSpacing` so it can be enabled by default without generating a lot of false positives for common alignment idioms.\r\n\r\nWe allow a token preceded by multiple spaces if either of these is true:\r\n1. there's a token on an adjacent line (previous or next), in the same column, also preceded by space\r\n2. the token's first character is also present on an adjacent line in the same column\r\n3. the token is an assignment operator, e.g. `+=` and the `=` is aligned with an `=` on an adjacent line\r\n4. the token is a comment and it's aligned with the previous or next comment\r\n\r\n```ruby\r\n# 1\r\na  = 1  if b == 2\r\naa = 10 unless bb == 20\r\n\r\n# 2\r\nlist             .select { |x| x > 3 }\r\n(list - unwanted).select { |x| x.even? }\r\n\r\n# 3\r\na ||= 1\r\na  += b\r\n\r\n# 4\r\nif a < 10\r\n  add_more # just in case\r\nend\r\ntake_half  # only fair\r\n```\r\n\r\nAs is hinted in example 1, an enabled `ExtraSpacing` would also check space before modifier keywords, rendering #2027 unnecessary."},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/120653216","html_url":"https://github.com/bbatsov/rubocop/issues/2035#issuecomment-120653216","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2035","id":120653216,"user":{"login":"bquorning","id":22333,"avatar_url":"https://avatars.githubusercontent.com/u/22333?v=3","gravatar_id":"","url":"https://api.github.com/users/bquorning","html_url":"https://github.com/bquorning","followers_url":"https://api.github.com/users/bquorning/followers","following_url":"https://api.github.com/users/bquorning/following{/other_user}","gists_url":"https://api.github.com/users/bquorning/gists{/gist_id}","starred_url":"https://api.github.com/users/bquorning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bquorning/subscriptions","organizations_url":"https://api.github.com/users/bquorning/orgs","repos_url":"https://api.github.com/users/bquorning/repos","events_url":"https://api.github.com/users/bquorning/events{/privacy}","received_events_url":"https://api.github.com/users/bquorning/received_events","type":"User","site_admin":false},"created_at":"2015-07-11T19:16:45Z","updated_at":"2015-07-11T19:16:45Z","body":"I misunderstood 1 (hadn’t noticed that `if` and `unless` were aligned). I would probably only enable 3, perhaps also 4."}}