{"action":"created","comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/59804031","id":59804031,"diff_hunk":"@@ -27,7 +27,7 @@ class NestedMethodDefinition < Cop\n         PATTERN\n \n         def_node_matcher :class_or_module_new_call?, <<-PATTERN","path":"lib/rubocop/cop/lint/nested_method_definition.rb","position":3,"original_position":3,"commit_id":"b91374c3f02581fabf28e841d1c37a66df9dbce2","original_commit_id":"b91374c3f02581fabf28e841d1c37a66df9dbce2","user":{"login":"emschwar","id":20406,"avatar_url":"https://avatars.githubusercontent.com/u/20406?v=3","gravatar_id":"","url":"https://api.github.com/users/emschwar","html_url":"https://github.com/emschwar","followers_url":"https://api.github.com/users/emschwar/followers","following_url":"https://api.github.com/users/emschwar/following{/other_user}","gists_url":"https://api.github.com/users/emschwar/gists{/gist_id}","starred_url":"https://api.github.com/users/emschwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emschwar/subscriptions","organizations_url":"https://api.github.com/users/emschwar/orgs","repos_url":"https://api.github.com/users/emschwar/repos","events_url":"https://api.github.com/users/emschwar/events{/privacy}","received_events_url":"https://api.github.com/users/emschwar/received_events","type":"User","site_admin":false},"body":"This isn't an accurate name for the node matcher after my change, but I didn't like the idea of just making it `:class_or_module_or_struct_new_call?`, so I am hoping someone else has a better name.","created_at":"2016-04-14T22:39:54Z","updated_at":"2016-04-14T22:39:54Z","html_url":"https://github.com/bbatsov/rubocop/pull/3050#discussion_r59804031","pull_request_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050","_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/59804031"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/3050#discussion_r59804031"},"pull_request":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050"}}},"pull_request":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050","id":66555836,"html_url":"https://github.com/bbatsov/rubocop/pull/3050","diff_url":"https://github.com/bbatsov/rubocop/pull/3050.diff","patch_url":"https://github.com/bbatsov/rubocop/pull/3050.patch","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3050","number":3050,"state":"open","locked":false,"title":"Structs don't trigger Lint/NestedMethodDefinition","user":{"login":"emschwar","id":20406,"avatar_url":"https://avatars.githubusercontent.com/u/20406?v=3","gravatar_id":"","url":"https://api.github.com/users/emschwar","html_url":"https://github.com/emschwar","followers_url":"https://api.github.com/users/emschwar/followers","following_url":"https://api.github.com/users/emschwar/following{/other_user}","gists_url":"https://api.github.com/users/emschwar/gists{/gist_id}","starred_url":"https://api.github.com/users/emschwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emschwar/subscriptions","organizations_url":"https://api.github.com/users/emschwar/orgs","repos_url":"https://api.github.com/users/emschwar/repos","events_url":"https://api.github.com/users/emschwar/events{/privacy}","received_events_url":"https://api.github.com/users/emschwar/received_events","type":"User","site_admin":false},"body":"Fixes #3048 \r\n\r\nThe recommended way to extend a Struct, per the Ruby documentation is\r\n\r\n```ruby\r\nStruct.new(:foo, :bar) do\r\n  def some_method\r\n    \"#{foo} #{bar}\"\r\n  end\r\nend\r\n```\r\nHowever, this code fails the Lint/NestedMethodDefinition cop. Add an exception\r\nalong the same lines as Class and Method so that Struct won't fail the cop.\r\n\r\nBefore submitting a PR make sure the following are checked:\r\n\r\n* [x] Wrote [good commit messages][1].\r\n* [x] Used the same coding conventions as the rest of the project.\r\n* [x] Feature branch is up-to-date with `master` (if not - rebase it)\r\n* [x] Squashed related commits together.\r\n* [x] Added tests.\r\n* [x] Added an entry to the [Changelog](CHANGELOG.md) if the new code introduces user-observable changes. See [changelog entry format](../CONTRIBUTING.md#changelog-entry-format).\r\n* [x] All tests are passing.\r\n* [x] The new code doesn't generate RuboCop offenses.\r\n* [x] The PR relates to *only* one subject with a clear title\r\n  and description in grammatically correct, complete sentences.\r\n\r\n[1]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html","created_at":"2016-04-14T21:20:16Z","updated_at":"2016-04-14T22:39:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe7e644e14c7f6a2de40cef036621b3cd266b295","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050/commits","review_comments_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050/comments","review_comment_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3050/comments","statuses_url":"https://api.github.com/repos/bbatsov/rubocop/statuses/b91374c3f02581fabf28e841d1c37a66df9dbce2","head":{"label":"emschwar:dont_raise_nested_method_definition_inside_struct","ref":"dont_raise_nested_method_definition_inside_struct","sha":"b91374c3f02581fabf28e841d1c37a66df9dbce2","user":{"login":"emschwar","id":20406,"avatar_url":"https://avatars.githubusercontent.com/u/20406?v=3","gravatar_id":"","url":"https://api.github.com/users/emschwar","html_url":"https://github.com/emschwar","followers_url":"https://api.github.com/users/emschwar/followers","following_url":"https://api.github.com/users/emschwar/following{/other_user}","gists_url":"https://api.github.com/users/emschwar/gists{/gist_id}","starred_url":"https://api.github.com/users/emschwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emschwar/subscriptions","organizations_url":"https://api.github.com/users/emschwar/orgs","repos_url":"https://api.github.com/users/emschwar/repos","events_url":"https://api.github.com/users/emschwar/events{/privacy}","received_events_url":"https://api.github.com/users/emschwar/received_events","type":"User","site_admin":false},"repo":{"id":42541121,"name":"rubocop","full_name":"emschwar/rubocop","owner":{"login":"emschwar","id":20406,"avatar_url":"https://avatars.githubusercontent.com/u/20406?v=3","gravatar_id":"","url":"https://api.github.com/users/emschwar","html_url":"https://github.com/emschwar","followers_url":"https://api.github.com/users/emschwar/followers","following_url":"https://api.github.com/users/emschwar/following{/other_user}","gists_url":"https://api.github.com/users/emschwar/gists{/gist_id}","starred_url":"https://api.github.com/users/emschwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emschwar/subscriptions","organizations_url":"https://api.github.com/users/emschwar/orgs","repos_url":"https://api.github.com/users/emschwar/repos","events_url":"https://api.github.com/users/emschwar/events{/privacy}","received_events_url":"https://api.github.com/users/emschwar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emschwar/rubocop","description":"A Ruby static code analyzer, based on the community Ruby style guide.","fork":true,"url":"https://api.github.com/repos/emschwar/rubocop","forks_url":"https://api.github.com/repos/emschwar/rubocop/forks","keys_url":"https://api.github.com/repos/emschwar/rubocop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emschwar/rubocop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emschwar/rubocop/teams","hooks_url":"https://api.github.com/repos/emschwar/rubocop/hooks","issue_events_url":"https://api.github.com/repos/emschwar/rubocop/issues/events{/number}","events_url":"https://api.github.com/repos/emschwar/rubocop/events","assignees_url":"https://api.github.com/repos/emschwar/rubocop/assignees{/user}","branches_url":"https://api.github.com/repos/emschwar/rubocop/branches{/branch}","tags_url":"https://api.github.com/repos/emschwar/rubocop/tags","blobs_url":"https://api.github.com/repos/emschwar/rubocop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emschwar/rubocop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emschwar/rubocop/git/refs{/sha}","trees_url":"https://api.github.com/repos/emschwar/rubocop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emschwar/rubocop/statuses/{sha}","languages_url":"https://api.github.com/repos/emschwar/rubocop/languages","stargazers_url":"https://api.github.com/repos/emschwar/rubocop/stargazers","contributors_url":"https://api.github.com/repos/emschwar/rubocop/contributors","subscribers_url":"https://api.github.com/repos/emschwar/rubocop/subscribers","subscription_url":"https://api.github.com/repos/emschwar/rubocop/subscription","commits_url":"https://api.github.com/repos/emschwar/rubocop/commits{/sha}","git_commits_url":"https://api.github.com/repos/emschwar/rubocop/git/commits{/sha}","comments_url":"https://api.github.com/repos/emschwar/rubocop/comments{/number}","issue_comment_url":"https://api.github.com/repos/emschwar/rubocop/issues/comments{/number}","contents_url":"https://api.github.com/repos/emschwar/rubocop/contents/{+path}","compare_url":"https://api.github.com/repos/emschwar/rubocop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emschwar/rubocop/merges","archive_url":"https://api.github.com/repos/emschwar/rubocop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emschwar/rubocop/downloads","issues_url":"https://api.github.com/repos/emschwar/rubocop/issues{/number}","pulls_url":"https://api.github.com/repos/emschwar/rubocop/pulls{/number}","milestones_url":"https://api.github.com/repos/emschwar/rubocop/milestones{/number}","notifications_url":"https://api.github.com/repos/emschwar/rubocop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emschwar/rubocop/labels{/name}","releases_url":"https://api.github.com/repos/emschwar/rubocop/releases{/id}","deployments_url":"https://api.github.com/repos/emschwar/rubocop/deployments","created_at":"2015-09-15T19:19:01Z","updated_at":"2015-09-15T19:19:03Z","pushed_at":"2016-04-14T21:14:34Z","git_url":"git://github.com/emschwar/rubocop.git","ssh_url":"git@github.com:emschwar/rubocop.git","clone_url":"https://github.com/emschwar/rubocop.git","svn_url":"https://github.com/emschwar/rubocop","homepage":"","size":11618,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bbatsov:master","ref":"master","sha":"3564db025d475397ab2a0ebb9d584a114421c198","user":{"login":"bbatsov","id":103882,"avatar_url":"https://avatars.githubusercontent.com/u/103882?v=3","gravatar_id":"","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"repo":{"id":4095287,"name":"rubocop","full_name":"bbatsov/rubocop","owner":{"login":"bbatsov","id":103882,"avatar_url":"https://avatars.githubusercontent.com/u/103882?v=3","gravatar_id":"","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbatsov/rubocop","description":"A Ruby static code analyzer, based on the community Ruby style guide.","fork":false,"url":"https://api.github.com/repos/bbatsov/rubocop","forks_url":"https://api.github.com/repos/bbatsov/rubocop/forks","keys_url":"https://api.github.com/repos/bbatsov/rubocop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbatsov/rubocop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbatsov/rubocop/teams","hooks_url":"https://api.github.com/repos/bbatsov/rubocop/hooks","issue_events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/events{/number}","events_url":"https://api.github.com/repos/bbatsov/rubocop/events","assignees_url":"https://api.github.com/repos/bbatsov/rubocop/assignees{/user}","branches_url":"https://api.github.com/repos/bbatsov/rubocop/branches{/branch}","tags_url":"https://api.github.com/repos/bbatsov/rubocop/tags","blobs_url":"https://api.github.com/repos/bbatsov/rubocop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbatsov/rubocop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbatsov/rubocop/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbatsov/rubocop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbatsov/rubocop/statuses/{sha}","languages_url":"https://api.github.com/repos/bbatsov/rubocop/languages","stargazers_url":"https://api.github.com/repos/bbatsov/rubocop/stargazers","contributors_url":"https://api.github.com/repos/bbatsov/rubocop/contributors","subscribers_url":"https://api.github.com/repos/bbatsov/rubocop/subscribers","subscription_url":"https://api.github.com/repos/bbatsov/rubocop/subscription","commits_url":"https://api.github.com/repos/bbatsov/rubocop/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbatsov/rubocop/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbatsov/rubocop/contents/{+path}","compare_url":"https://api.github.com/repos/bbatsov/rubocop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbatsov/rubocop/merges","archive_url":"https://api.github.com/repos/bbatsov/rubocop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbatsov/rubocop/downloads","issues_url":"https://api.github.com/repos/bbatsov/rubocop/issues{/number}","pulls_url":"https://api.github.com/repos/bbatsov/rubocop/pulls{/number}","milestones_url":"https://api.github.com/repos/bbatsov/rubocop/milestones{/number}","notifications_url":"https://api.github.com/repos/bbatsov/rubocop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbatsov/rubocop/labels{/name}","releases_url":"https://api.github.com/repos/bbatsov/rubocop/releases{/id}","deployments_url":"https://api.github.com/repos/bbatsov/rubocop/deployments","created_at":"2012-04-21T10:09:58Z","updated_at":"2016-04-14T22:22:57Z","pushed_at":"2016-04-14T22:04:24Z","git_url":"git://github.com/bbatsov/rubocop.git","ssh_url":"git@github.com:bbatsov/rubocop.git","clone_url":"https://github.com/bbatsov/rubocop.git","svn_url":"https://github.com/bbatsov/rubocop","homepage":"","size":15132,"stargazers_count":6161,"watchers_count":6161,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":816,"mirror_url":null,"open_issues_count":104,"forks":816,"open_issues":104,"watchers":6161,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/3050"},"issue":{"href":"https://api.github.com/repos/bbatsov/rubocop/issues/3050"},"comments":{"href":"https://api.github.com/repos/bbatsov/rubocop/issues/3050/comments"},"review_comments":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050/comments"},"review_comment":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3050/commits"},"statuses":{"href":"https://api.github.com/repos/bbatsov/rubocop/statuses/b91374c3f02581fabf28e841d1c37a66df9dbce2"}}}}