{"action":"created","issue":{"url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5949","repository_url":"https://api.github.com/repos/rubocop-hq/rubocop","labels_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5949/labels{/name}","comments_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5949/comments","events_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5949/events","html_url":"https://github.com/rubocop-hq/rubocop/issues/5949","id":329468318,"node_id":"MDU6SXNzdWUzMjk0NjgzMTg=","number":5949,"title":" Lint/EnsureReturn cop - why ensure must not return","user":{"login":"ckornaros","id":5371009,"node_id":"MDQ6VXNlcjUzNzEwMDk=","avatar_url":"https://avatars0.githubusercontent.com/u/5371009?v=4","gravatar_id":"","url":"https://api.github.com/users/ckornaros","html_url":"https://github.com/ckornaros","followers_url":"https://api.github.com/users/ckornaros/followers","following_url":"https://api.github.com/users/ckornaros/following{/other_user}","gists_url":"https://api.github.com/users/ckornaros/gists{/gist_id}","starred_url":"https://api.github.com/users/ckornaros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckornaros/subscriptions","organizations_url":"https://api.github.com/users/ckornaros/orgs","repos_url":"https://api.github.com/users/ckornaros/repos","events_url":"https://api.github.com/users/ckornaros/events{/privacy}","received_events_url":"https://api.github.com/users/ckornaros/received_events","type":"User","site_admin":false},"labels":[{"id":3608336,"node_id":"MDU6TGFiZWwzNjA4MzM2","url":"https://api.github.com/repos/rubocop-hq/rubocop/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-05T13:56:04Z","updated_at":"2018-06-05T17:53:01Z","closed_at":null,"author_association":"NONE","body":"In my code I have an ensure like that:\r\n\r\n```\r\nensure\r\n   return false unless successfully_updated(result)\r\nend\r\n```\r\n\r\nAnd rubocop show me the following warning : Lint/EnsureReturn: Do not return from an ensure block.\r\n\r\nBut if I removed the return the result will not be the same.\r\n\r\nExemple:\r\n```\r\ndef test_ensure_without_return\r\n  true\r\nensure\r\n  false  \r\nend\r\n```\r\n\r\n> test_ensure_without_return\r\n> => true\r\n\r\n```\r\ndef test_ensure_with_return\r\n  true\r\nensure\r\n  return false  \r\nend\r\n```\r\n> test_ensure_with_return\r\n> => false\r\n\r\nSo is there a reason that ensure must not return a value ?\r\n\r\n## RuboCop version\r\n0.54.0 (using Parser 2.5.0.5, running on ruby 2.3.1 x86_64-linux)\r\n"},"comment":{"url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/comments/394801703","html_url":"https://github.com/rubocop-hq/rubocop/issues/5949#issuecomment-394801703","issue_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/5949","id":394801703,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDgwMTcwMw==","user":{"login":"mikegee","id":14068,"node_id":"MDQ6VXNlcjE0MDY4","avatar_url":"https://avatars3.githubusercontent.com/u/14068?v=4","gravatar_id":"","url":"https://api.github.com/users/mikegee","html_url":"https://github.com/mikegee","followers_url":"https://api.github.com/users/mikegee/followers","following_url":"https://api.github.com/users/mikegee/following{/other_user}","gists_url":"https://api.github.com/users/mikegee/gists{/gist_id}","starred_url":"https://api.github.com/users/mikegee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikegee/subscriptions","organizations_url":"https://api.github.com/users/mikegee/orgs","repos_url":"https://api.github.com/users/mikegee/repos","events_url":"https://api.github.com/users/mikegee/events{/privacy}","received_events_url":"https://api.github.com/users/mikegee/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T17:53:01Z","updated_at":"2018-06-05T17:53:01Z","author_association":"CONTRIBUTOR","body":"Google lead me to [this blog post](http://blog.leshill.org/blog/2009/11/17/ensure-with-explicit-return.html). Apparently, `ensure` with explicit `return` also silently `rescue`s."}}
{"actor":{"display_login":"mikegee"}}