{"action":"closed","number":891,"pull_request":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/891","id":27084479,"html_url":"https://github.com/jscs-dev/node-jscs/pull/891","diff_url":"https://github.com/jscs-dev/node-jscs/pull/891.diff","patch_url":"https://github.com/jscs-dev/node-jscs/pull/891.patch","issue_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/891","number":891,"state":"closed","locked":false,"title":"Added rules `requireNamedUnassignedFunctions` and `disallowNamedUnassignedFunctions`. Fixes #655, #834.","user":{"login":"twolfson","id":902488,"avatar_url":"https://avatars.githubusercontent.com/u/902488?v=3","gravatar_id":"","url":"https://api.github.com/users/twolfson","html_url":"https://github.com/twolfson","followers_url":"https://api.github.com/users/twolfson/followers","following_url":"https://api.github.com/users/twolfson/following{/other_user}","gists_url":"https://api.github.com/users/twolfson/gists{/gist_id}","starred_url":"https://api.github.com/users/twolfson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twolfson/subscriptions","organizations_url":"https://api.github.com/users/twolfson/orgs","repos_url":"https://api.github.com/users/twolfson/repos","events_url":"https://api.github.com/users/twolfson/events{/privacy}","received_events_url":"https://api.github.com/users/twolfson/received_events","type":"User","site_admin":false},"body":"As discussed in #655 and #834, there is no middle ground for requiring names on anonymous functions/not. These new rules aim to fix that by only requiring naming if the function has not been named by other means (i.e. no left hand assignment). In this PR:\r\n\r\n- Added `requireNamedUnassignedFunctions` and `disallowNamedUnassignedFunctions` rules\r\n- Added tests\r\n\r\n**Missing:**\r\n\r\n## Documentation\r\nI couldn't find a place to put descriptions for the new rules. However, they would read something like:\r\n\r\n### requireNamedUnassignedFunctions\r\nRequire inline name for any function that has not been assigned via a left-hand operator.\r\n\r\nType: `Boolean` or `Object`\r\n\r\nValues:\r\n\r\n- `true`\r\n- `Object`:\r\n    - `allExcept`: array of function names/methods to skip over if `function` is used as a parameter\r\n\r\n**Example**\r\n\r\n```js\r\n\"requireNamedUnassignedFunctions\": { allExcept: [\"describe\", \"describe.skip\", \"it\", \"it.skip\"] }\r\n```\r\n\r\n**Valid**\r\n\r\n```js\r\nvar foo = function() {};\r\n[1].forEach(function iterateItems() {});\r\nit(function() {}); // Valid because of `allExcept`\r\n```\r\n\r\n**Invalid**\r\n\r\n```js\r\n[1].forEach(function() {});\r\nbefore(function() {});\r\n```\r\n\r\n### disallowNamedUnassignedFunctions\r\nDisallow inline name for any function that has not been assigned via a left-hand operator.\r\n\r\nType: `Boolean`\r\n\r\nValues: `true`\r\n\r\n**Example**\r\n\r\n```js\r\n\"disallowNamedUnassignedFunctions\": true\r\n```\r\n\r\n**Valid**\r\n\r\n```js\r\nvar foo = function() {};\r\n[1].forEach(function() {});\r\nbefore(function() {});\r\n```\r\n\r\n**Invalid**\r\n\r\n```js\r\n[1].forEach(function iterateItems() {});\r\nbefore(function setupServer() {});\r\n```\r\n\r\n## Wildcards\r\nIt is possible people will want to use wildcards (e.g. `it.*`). However, this is an edge case on top of an edge case. It is hard to know exactly the use case so I have decided to defer implementation until someone brings it up as a necessity.","created_at":"2015-01-09T07:43:03Z","updated_at":"2015-04-12T16:50:59Z","closed_at":"2015-04-12T16:50:59Z","merged_at":null,"merge_commit_sha":"75fcd24c579f2b0dcdb86f5b4b2263ab0966eae7","assignee":null,"milestone":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/milestones/10","html_url":"https://github.com/jscs-dev/node-jscs/milestones/1.12","labels_url":"https://api.github.com/repos/jscs-dev/node-jscs/milestones/10/labels","id":962596,"number":10,"title":"1.12","description":"Autofixing!","creator":{"login":"mikesherov","id":364532,"avatar_url":"https://avatars.githubusercontent.com/u/364532?v=3","gravatar_id":"","url":"https://api.github.com/users/mikesherov","html_url":"https://github.com/mikesherov","followers_url":"https://api.github.com/users/mikesherov/followers","following_url":"https://api.github.com/users/mikesherov/following{/other_user}","gists_url":"https://api.github.com/users/mikesherov/gists{/gist_id}","starred_url":"https://api.github.com/users/mikesherov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikesherov/subscriptions","organizations_url":"https://api.github.com/users/mikesherov/orgs","repos_url":"https://api.github.com/users/mikesherov/repos","events_url":"https://api.github.com/users/mikesherov/events{/privacy}","received_events_url":"https://api.github.com/users/mikesherov/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":12,"state":"open","created_at":"2015-02-02T23:09:35Z","updated_at":"2015-04-12T16:50:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/891/commits","review_comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/891/comments","review_comment_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/891/comments","statuses_url":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/0a227494a30fd18948f931de637497314a2821e2","head":{"label":"twolfson:dev/add.require.named.inline.sqwished","ref":"dev/add.require.named.inline.sqwished","sha":"0a227494a30fd18948f931de637497314a2821e2","user":{"login":"twolfson","id":902488,"avatar_url":"https://avatars.githubusercontent.com/u/902488?v=3","gravatar_id":"","url":"https://api.github.com/users/twolfson","html_url":"https://github.com/twolfson","followers_url":"https://api.github.com/users/twolfson/followers","following_url":"https://api.github.com/users/twolfson/following{/other_user}","gists_url":"https://api.github.com/users/twolfson/gists{/gist_id}","starred_url":"https://api.github.com/users/twolfson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twolfson/subscriptions","organizations_url":"https://api.github.com/users/twolfson/orgs","repos_url":"https://api.github.com/users/twolfson/repos","events_url":"https://api.github.com/users/twolfson/events{/privacy}","received_events_url":"https://api.github.com/users/twolfson/received_events","type":"User","site_admin":false},"repo":{"id":26903629,"name":"node-jscs","full_name":"twolfson/node-jscs","owner":{"login":"twolfson","id":902488,"avatar_url":"https://avatars.githubusercontent.com/u/902488?v=3","gravatar_id":"","url":"https://api.github.com/users/twolfson","html_url":"https://github.com/twolfson","followers_url":"https://api.github.com/users/twolfson/followers","following_url":"https://api.github.com/users/twolfson/following{/other_user}","gists_url":"https://api.github.com/users/twolfson/gists{/gist_id}","starred_url":"https://api.github.com/users/twolfson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twolfson/subscriptions","organizations_url":"https://api.github.com/users/twolfson/orgs","repos_url":"https://api.github.com/users/twolfson/repos","events_url":"https://api.github.com/users/twolfson/events{/privacy}","received_events_url":"https://api.github.com/users/twolfson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/twolfson/node-jscs","description":"JavaScript Code Style checker","fork":true,"url":"https://api.github.com/repos/twolfson/node-jscs","forks_url":"https://api.github.com/repos/twolfson/node-jscs/forks","keys_url":"https://api.github.com/repos/twolfson/node-jscs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twolfson/node-jscs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twolfson/node-jscs/teams","hooks_url":"https://api.github.com/repos/twolfson/node-jscs/hooks","issue_events_url":"https://api.github.com/repos/twolfson/node-jscs/issues/events{/number}","events_url":"https://api.github.com/repos/twolfson/node-jscs/events","assignees_url":"https://api.github.com/repos/twolfson/node-jscs/assignees{/user}","branches_url":"https://api.github.com/repos/twolfson/node-jscs/branches{/branch}","tags_url":"https://api.github.com/repos/twolfson/node-jscs/tags","blobs_url":"https://api.github.com/repos/twolfson/node-jscs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twolfson/node-jscs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twolfson/node-jscs/git/refs{/sha}","trees_url":"https://api.github.com/repos/twolfson/node-jscs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twolfson/node-jscs/statuses/{sha}","languages_url":"https://api.github.com/repos/twolfson/node-jscs/languages","stargazers_url":"https://api.github.com/repos/twolfson/node-jscs/stargazers","contributors_url":"https://api.github.com/repos/twolfson/node-jscs/contributors","subscribers_url":"https://api.github.com/repos/twolfson/node-jscs/subscribers","subscription_url":"https://api.github.com/repos/twolfson/node-jscs/subscription","commits_url":"https://api.github.com/repos/twolfson/node-jscs/commits{/sha}","git_commits_url":"https://api.github.com/repos/twolfson/node-jscs/git/commits{/sha}","comments_url":"https://api.github.com/repos/twolfson/node-jscs/comments{/number}","issue_comment_url":"https://api.github.com/repos/twolfson/node-jscs/issues/comments{/number}","contents_url":"https://api.github.com/repos/twolfson/node-jscs/contents/{+path}","compare_url":"https://api.github.com/repos/twolfson/node-jscs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twolfson/node-jscs/merges","archive_url":"https://api.github.com/repos/twolfson/node-jscs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twolfson/node-jscs/downloads","issues_url":"https://api.github.com/repos/twolfson/node-jscs/issues{/number}","pulls_url":"https://api.github.com/repos/twolfson/node-jscs/pulls{/number}","milestones_url":"https://api.github.com/repos/twolfson/node-jscs/milestones{/number}","notifications_url":"https://api.github.com/repos/twolfson/node-jscs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twolfson/node-jscs/labels{/name}","releases_url":"https://api.github.com/repos/twolfson/node-jscs/releases{/id}","created_at":"2014-11-20T08:48:21Z","updated_at":"2015-04-07T06:56:57Z","pushed_at":"2015-04-07T07:33:19Z","git_url":"git://github.com/twolfson/node-jscs.git","ssh_url":"git@github.com:twolfson/node-jscs.git","clone_url":"https://github.com/twolfson/node-jscs.git","svn_url":"https://github.com/twolfson/node-jscs","homepage":"","size":2985,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jscs-dev:master","ref":"master","sha":"c668ff1be0b1cfa058866048944bad3df7ff7cbc","user":{"login":"jscs-dev","id":8018201,"avatar_url":"https://avatars.githubusercontent.com/u/8018201?v=3","gravatar_id":"","url":"https://api.github.com/users/jscs-dev","html_url":"https://github.com/jscs-dev","followers_url":"https://api.github.com/users/jscs-dev/followers","following_url":"https://api.github.com/users/jscs-dev/following{/other_user}","gists_url":"https://api.github.com/users/jscs-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/jscs-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscs-dev/subscriptions","organizations_url":"https://api.github.com/users/jscs-dev/orgs","repos_url":"https://api.github.com/users/jscs-dev/repos","events_url":"https://api.github.com/users/jscs-dev/events{/privacy}","received_events_url":"https://api.github.com/users/jscs-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":10697582,"name":"node-jscs","full_name":"jscs-dev/node-jscs","owner":{"login":"jscs-dev","id":8018201,"avatar_url":"https://avatars.githubusercontent.com/u/8018201?v=3","gravatar_id":"","url":"https://api.github.com/users/jscs-dev","html_url":"https://github.com/jscs-dev","followers_url":"https://api.github.com/users/jscs-dev/followers","following_url":"https://api.github.com/users/jscs-dev/following{/other_user}","gists_url":"https://api.github.com/users/jscs-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/jscs-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jscs-dev/subscriptions","organizations_url":"https://api.github.com/users/jscs-dev/orgs","repos_url":"https://api.github.com/users/jscs-dev/repos","events_url":"https://api.github.com/users/jscs-dev/events{/privacy}","received_events_url":"https://api.github.com/users/jscs-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jscs-dev/node-jscs","description":"JavaScript Code Style checker","fork":false,"url":"https://api.github.com/repos/jscs-dev/node-jscs","forks_url":"https://api.github.com/repos/jscs-dev/node-jscs/forks","keys_url":"https://api.github.com/repos/jscs-dev/node-jscs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jscs-dev/node-jscs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jscs-dev/node-jscs/teams","hooks_url":"https://api.github.com/repos/jscs-dev/node-jscs/hooks","issue_events_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/events{/number}","events_url":"https://api.github.com/repos/jscs-dev/node-jscs/events","assignees_url":"https://api.github.com/repos/jscs-dev/node-jscs/assignees{/user}","branches_url":"https://api.github.com/repos/jscs-dev/node-jscs/branches{/branch}","tags_url":"https://api.github.com/repos/jscs-dev/node-jscs/tags","blobs_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/refs{/sha}","trees_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/{sha}","languages_url":"https://api.github.com/repos/jscs-dev/node-jscs/languages","stargazers_url":"https://api.github.com/repos/jscs-dev/node-jscs/stargazers","contributors_url":"https://api.github.com/repos/jscs-dev/node-jscs/contributors","subscribers_url":"https://api.github.com/repos/jscs-dev/node-jscs/subscribers","subscription_url":"https://api.github.com/repos/jscs-dev/node-jscs/subscription","commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/commits{/sha}","git_commits_url":"https://api.github.com/repos/jscs-dev/node-jscs/git/commits{/sha}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/comments{/number}","issue_comment_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/comments{/number}","contents_url":"https://api.github.com/repos/jscs-dev/node-jscs/contents/{+path}","compare_url":"https://api.github.com/repos/jscs-dev/node-jscs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jscs-dev/node-jscs/merges","archive_url":"https://api.github.com/repos/jscs-dev/node-jscs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jscs-dev/node-jscs/downloads","issues_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues{/number}","pulls_url":"https://api.github.com/repos/jscs-dev/node-jscs/pulls{/number}","milestones_url":"https://api.github.com/repos/jscs-dev/node-jscs/milestones{/number}","notifications_url":"https://api.github.com/repos/jscs-dev/node-jscs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jscs-dev/node-jscs/labels{/name}","releases_url":"https://api.github.com/repos/jscs-dev/node-jscs/releases{/id}","created_at":"2013-06-14T20:53:48Z","updated_at":"2015-04-12T16:50:58Z","pushed_at":"2015-04-12T16:50:58Z","git_url":"git://github.com/jscs-dev/node-jscs.git","ssh_url":"git@github.com:jscs-dev/node-jscs.git","clone_url":"https://github.com/jscs-dev/node-jscs.git","svn_url":"https://github.com/jscs-dev/node-jscs","homepage":"http://jscs.info/","size":11899,"stargazers_count":2970,"watchers_count":2970,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":289,"mirror_url":null,"open_issues_count":157,"forks":289,"open_issues":157,"watchers":2970,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/891"},"html":{"href":"https://github.com/jscs-dev/node-jscs/pull/891"},"issue":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/issues/891"},"comments":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/issues/891/comments"},"review_comments":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/891/comments"},"review_comment":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/pulls/891/commits"},"statuses":{"href":"https://api.github.com/repos/jscs-dev/node-jscs/statuses/0a227494a30fd18948f931de637497314a2821e2"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":18,"review_comments":2,"commits":1,"additions":337,"deletions":0,"changed_files":6}}