{"action":"created","comment":{"url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/comments/47718133","id":47718133,"diff_hunk":"@@ -0,0 +1,68 @@\n+'use strict';\n+\n+/**\n+ * Module dependencies.\n+ */\n+\n+import assert from 'assert';\n+import get from 'lodash.get';\n+import parser from 'simple-sql-parser';\n+\n+/**\n+ * Check if String is an SQL query.\n+ */\n+\n+function isSQLQuery(literal) {\n+  return literal && Object.keys(parser.sql2ast(literal)).length > 0;\n+}\n+\n+/**\n+ * Export `requireSqlTemplate`.\n+ */\n+\n+const requireSqlTemplate = () => {};\n+\n+requireSqlTemplate.prototype = {\n+  check: (file, errors) => {\n+    file.iterateNodesByType('VariableDeclaration', (node) => {\n+      node.declarations.forEach((declaration) => {\n+        const name = get(declaration, 'init.tag.name');\n+        const literal = get(declaration, 'init.value');\n+\n+        if (isSQLQuery(literal) && name !== 'sql') {","path":"src/rules/require-sql-template.js","position":32,"original_position":32,"commit_id":"f38ef40274ad3d1bc4e058e636399b059531fdc2","original_commit_id":"f38ef40274ad3d1bc4e058e636399b059531fdc2","user":{"login":"ruimarinho","id":288709,"avatar_url":"https://avatars.githubusercontent.com/u/288709?v=3","gravatar_id":"","url":"https://api.github.com/users/ruimarinho","html_url":"https://github.com/ruimarinho","followers_url":"https://api.github.com/users/ruimarinho/followers","following_url":"https://api.github.com/users/ruimarinho/following{/other_user}","gists_url":"https://api.github.com/users/ruimarinho/gists{/gist_id}","starred_url":"https://api.github.com/users/ruimarinho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruimarinho/subscriptions","organizations_url":"https://api.github.com/users/ruimarinho/orgs","repos_url":"https://api.github.com/users/ruimarinho/repos","events_url":"https://api.github.com/users/ruimarinho/events{/privacy}","received_events_url":"https://api.github.com/users/ruimarinho/received_events","type":"User","site_admin":false},"body":"Early return here?","created_at":"2015-12-15T23:58:21Z","updated_at":"2015-12-15T23:58:21Z","html_url":"https://github.com/seegno/jscs-config-seegno/pull/14#discussion_r47718133","pull_request_url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/comments/47718133"},"html":{"href":"https://github.com/seegno/jscs-config-seegno/pull/14#discussion_r47718133"},"pull_request":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14","id":53474572,"html_url":"https://github.com/seegno/jscs-config-seegno/pull/14","diff_url":"https://github.com/seegno/jscs-config-seegno/pull/14.diff","patch_url":"https://github.com/seegno/jscs-config-seegno/pull/14.patch","issue_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/14","number":14,"state":"open","locked":false,"title":"Replace `requireSqlTemplateInQueryFunction` rule","user":{"login":"ruiquelhas","id":413255,"avatar_url":"https://avatars.githubusercontent.com/u/413255?v=3","gravatar_id":"","url":"https://api.github.com/users/ruiquelhas","html_url":"https://github.com/ruiquelhas","followers_url":"https://api.github.com/users/ruiquelhas/followers","following_url":"https://api.github.com/users/ruiquelhas/following{/other_user}","gists_url":"https://api.github.com/users/ruiquelhas/gists{/gist_id}","starred_url":"https://api.github.com/users/ruiquelhas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruiquelhas/subscriptions","organizations_url":"https://api.github.com/users/ruiquelhas/orgs","repos_url":"https://api.github.com/users/ruiquelhas/repos","events_url":"https://api.github.com/users/ruiquelhas/events{/privacy}","received_events_url":"https://api.github.com/users/ruiquelhas/received_events","type":"User","site_admin":false},"body":"Resolves #13.","created_at":"2015-12-12T11:44:32Z","updated_at":"2015-12-15T23:58:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f25852e230ea4b9b4f8985956a20fadab995b644","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14/commits","review_comments_url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14/comments","review_comment_url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/comments{/number}","comments_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/14/comments","statuses_url":"https://api.github.com/repos/seegno/jscs-config-seegno/statuses/f38ef40274ad3d1bc4e058e636399b059531fdc2","head":{"label":"seegno:enhancement/broader-sql-template-query-enforcement","ref":"enhancement/broader-sql-template-query-enforcement","sha":"f38ef40274ad3d1bc4e058e636399b059531fdc2","user":{"login":"seegno","id":1326469,"avatar_url":"https://avatars.githubusercontent.com/u/1326469?v=3","gravatar_id":"","url":"https://api.github.com/users/seegno","html_url":"https://github.com/seegno","followers_url":"https://api.github.com/users/seegno/followers","following_url":"https://api.github.com/users/seegno/following{/other_user}","gists_url":"https://api.github.com/users/seegno/gists{/gist_id}","starred_url":"https://api.github.com/users/seegno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seegno/subscriptions","organizations_url":"https://api.github.com/users/seegno/orgs","repos_url":"https://api.github.com/users/seegno/repos","events_url":"https://api.github.com/users/seegno/events{/privacy}","received_events_url":"https://api.github.com/users/seegno/received_events","type":"Organization","site_admin":false},"repo":{"id":45393276,"name":"jscs-config-seegno","full_name":"seegno/jscs-config-seegno","owner":{"login":"seegno","id":1326469,"avatar_url":"https://avatars.githubusercontent.com/u/1326469?v=3","gravatar_id":"","url":"https://api.github.com/users/seegno","html_url":"https://github.com/seegno","followers_url":"https://api.github.com/users/seegno/followers","following_url":"https://api.github.com/users/seegno/following{/other_user}","gists_url":"https://api.github.com/users/seegno/gists{/gist_id}","starred_url":"https://api.github.com/users/seegno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seegno/subscriptions","organizations_url":"https://api.github.com/users/seegno/orgs","repos_url":"https://api.github.com/users/seegno/repos","events_url":"https://api.github.com/users/seegno/events{/privacy}","received_events_url":"https://api.github.com/users/seegno/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/seegno/jscs-config-seegno","description":"Seegno-flavored JSCS config","fork":false,"url":"https://api.github.com/repos/seegno/jscs-config-seegno","forks_url":"https://api.github.com/repos/seegno/jscs-config-seegno/forks","keys_url":"https://api.github.com/repos/seegno/jscs-config-seegno/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seegno/jscs-config-seegno/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seegno/jscs-config-seegno/teams","hooks_url":"https://api.github.com/repos/seegno/jscs-config-seegno/hooks","issue_events_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/events{/number}","events_url":"https://api.github.com/repos/seegno/jscs-config-seegno/events","assignees_url":"https://api.github.com/repos/seegno/jscs-config-seegno/assignees{/user}","branches_url":"https://api.github.com/repos/seegno/jscs-config-seegno/branches{/branch}","tags_url":"https://api.github.com/repos/seegno/jscs-config-seegno/tags","blobs_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/refs{/sha}","trees_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seegno/jscs-config-seegno/statuses/{sha}","languages_url":"https://api.github.com/repos/seegno/jscs-config-seegno/languages","stargazers_url":"https://api.github.com/repos/seegno/jscs-config-seegno/stargazers","contributors_url":"https://api.github.com/repos/seegno/jscs-config-seegno/contributors","subscribers_url":"https://api.github.com/repos/seegno/jscs-config-seegno/subscribers","subscription_url":"https://api.github.com/repos/seegno/jscs-config-seegno/subscription","commits_url":"https://api.github.com/repos/seegno/jscs-config-seegno/commits{/sha}","git_commits_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/commits{/sha}","comments_url":"https://api.github.com/repos/seegno/jscs-config-seegno/comments{/number}","issue_comment_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/comments{/number}","contents_url":"https://api.github.com/repos/seegno/jscs-config-seegno/contents/{+path}","compare_url":"https://api.github.com/repos/seegno/jscs-config-seegno/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seegno/jscs-config-seegno/merges","archive_url":"https://api.github.com/repos/seegno/jscs-config-seegno/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seegno/jscs-config-seegno/downloads","issues_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues{/number}","pulls_url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls{/number}","milestones_url":"https://api.github.com/repos/seegno/jscs-config-seegno/milestones{/number}","notifications_url":"https://api.github.com/repos/seegno/jscs-config-seegno/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seegno/jscs-config-seegno/labels{/name}","releases_url":"https://api.github.com/repos/seegno/jscs-config-seegno/releases{/id}","created_at":"2015-11-02T12:32:38Z","updated_at":"2015-12-09T12:15:16Z","pushed_at":"2015-12-12T11:44:32Z","git_url":"git://github.com/seegno/jscs-config-seegno.git","ssh_url":"git@github.com:seegno/jscs-config-seegno.git","clone_url":"https://github.com/seegno/jscs-config-seegno.git","svn_url":"https://github.com/seegno/jscs-config-seegno","homepage":"","size":14,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"seegno:master","ref":"master","sha":"e080eba27fd8888bbc2883c13fa01cf4d47a16d0","user":{"login":"seegno","id":1326469,"avatar_url":"https://avatars.githubusercontent.com/u/1326469?v=3","gravatar_id":"","url":"https://api.github.com/users/seegno","html_url":"https://github.com/seegno","followers_url":"https://api.github.com/users/seegno/followers","following_url":"https://api.github.com/users/seegno/following{/other_user}","gists_url":"https://api.github.com/users/seegno/gists{/gist_id}","starred_url":"https://api.github.com/users/seegno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seegno/subscriptions","organizations_url":"https://api.github.com/users/seegno/orgs","repos_url":"https://api.github.com/users/seegno/repos","events_url":"https://api.github.com/users/seegno/events{/privacy}","received_events_url":"https://api.github.com/users/seegno/received_events","type":"Organization","site_admin":false},"repo":{"id":45393276,"name":"jscs-config-seegno","full_name":"seegno/jscs-config-seegno","owner":{"login":"seegno","id":1326469,"avatar_url":"https://avatars.githubusercontent.com/u/1326469?v=3","gravatar_id":"","url":"https://api.github.com/users/seegno","html_url":"https://github.com/seegno","followers_url":"https://api.github.com/users/seegno/followers","following_url":"https://api.github.com/users/seegno/following{/other_user}","gists_url":"https://api.github.com/users/seegno/gists{/gist_id}","starred_url":"https://api.github.com/users/seegno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seegno/subscriptions","organizations_url":"https://api.github.com/users/seegno/orgs","repos_url":"https://api.github.com/users/seegno/repos","events_url":"https://api.github.com/users/seegno/events{/privacy}","received_events_url":"https://api.github.com/users/seegno/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/seegno/jscs-config-seegno","description":"Seegno-flavored JSCS config","fork":false,"url":"https://api.github.com/repos/seegno/jscs-config-seegno","forks_url":"https://api.github.com/repos/seegno/jscs-config-seegno/forks","keys_url":"https://api.github.com/repos/seegno/jscs-config-seegno/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seegno/jscs-config-seegno/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seegno/jscs-config-seegno/teams","hooks_url":"https://api.github.com/repos/seegno/jscs-config-seegno/hooks","issue_events_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/events{/number}","events_url":"https://api.github.com/repos/seegno/jscs-config-seegno/events","assignees_url":"https://api.github.com/repos/seegno/jscs-config-seegno/assignees{/user}","branches_url":"https://api.github.com/repos/seegno/jscs-config-seegno/branches{/branch}","tags_url":"https://api.github.com/repos/seegno/jscs-config-seegno/tags","blobs_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/refs{/sha}","trees_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seegno/jscs-config-seegno/statuses/{sha}","languages_url":"https://api.github.com/repos/seegno/jscs-config-seegno/languages","stargazers_url":"https://api.github.com/repos/seegno/jscs-config-seegno/stargazers","contributors_url":"https://api.github.com/repos/seegno/jscs-config-seegno/contributors","subscribers_url":"https://api.github.com/repos/seegno/jscs-config-seegno/subscribers","subscription_url":"https://api.github.com/repos/seegno/jscs-config-seegno/subscription","commits_url":"https://api.github.com/repos/seegno/jscs-config-seegno/commits{/sha}","git_commits_url":"https://api.github.com/repos/seegno/jscs-config-seegno/git/commits{/sha}","comments_url":"https://api.github.com/repos/seegno/jscs-config-seegno/comments{/number}","issue_comment_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/comments{/number}","contents_url":"https://api.github.com/repos/seegno/jscs-config-seegno/contents/{+path}","compare_url":"https://api.github.com/repos/seegno/jscs-config-seegno/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seegno/jscs-config-seegno/merges","archive_url":"https://api.github.com/repos/seegno/jscs-config-seegno/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seegno/jscs-config-seegno/downloads","issues_url":"https://api.github.com/repos/seegno/jscs-config-seegno/issues{/number}","pulls_url":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls{/number}","milestones_url":"https://api.github.com/repos/seegno/jscs-config-seegno/milestones{/number}","notifications_url":"https://api.github.com/repos/seegno/jscs-config-seegno/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seegno/jscs-config-seegno/labels{/name}","releases_url":"https://api.github.com/repos/seegno/jscs-config-seegno/releases{/id}","created_at":"2015-11-02T12:32:38Z","updated_at":"2015-12-09T12:15:16Z","pushed_at":"2015-12-12T11:44:32Z","git_url":"git://github.com/seegno/jscs-config-seegno.git","ssh_url":"git@github.com:seegno/jscs-config-seegno.git","clone_url":"https://github.com/seegno/jscs-config-seegno.git","svn_url":"https://github.com/seegno/jscs-config-seegno","homepage":"","size":14,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14"},"html":{"href":"https://github.com/seegno/jscs-config-seegno/pull/14"},"issue":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/14"},"comments":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/seegno/jscs-config-seegno/statuses/f38ef40274ad3d1bc4e058e636399b059531fdc2"}}}}