{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/comments/179560328","pull_request_review_id":109828188,"id":179560328,"diff_hunk":"@@ -0,0 +1,57 @@\n+/**\n+ * @fileoverview Bans nested 'it' methods.\n+ * As these cause falsy positive in unit tests.\n+ */\n+\n+import * as ts from 'typescript';\n+\n+import { Checker } from '../checker';\n+import { ErrorCode } from '../error_code';\n+import { AbstractRule } from '../rule';\n+\n+const FAILURE_STRING = `Nested 'it' are not allowed. Did you mean to use 'describe'?`;\n+\n+export class Rule extends AbstractRule {\n+\treadonly ruleName = 'ban_nested_it';\n+\treadonly code = ErrorCode.BAN_NESTED_IT;\n+\n+\tregister(checker: Checker) {\n+\t\tchecker.on(ts.SyntaxKind.CallExpression, checkCallExpression, this.code);\n+\t}\n+}\n+\n+function checkCallExpression(checker: Checker, node: ts.CallExpression) {\n+\tconst identifier = (node.expression as ts.Identifier);\n+\tif (identifier.getText() === 'it' && hasNestedItExpression(node)) {","path":"internal/tsetse/rules/ban_nested_it.ts","position":25,"original_position":25,"commit_id":"268fedf4511c84ac331809afc919d85fc4990cbe","original_commit_id":"fbc793b7e7be9487e5c333b34746d429fc13274a","user":{"login":"alan-agius4","id":17563226,"avatar_url":"https://avatars3.githubusercontent.com/u/17563226?v=4","gravatar_id":"","url":"https://api.github.com/users/alan-agius4","html_url":"https://github.com/alan-agius4","followers_url":"https://api.github.com/users/alan-agius4/followers","following_url":"https://api.github.com/users/alan-agius4/following{/other_user}","gists_url":"https://api.github.com/users/alan-agius4/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-agius4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-agius4/subscriptions","organizations_url":"https://api.github.com/users/alan-agius4/orgs","repos_url":"https://api.github.com/users/alan-agius4/repos","events_url":"https://api.github.com/users/alan-agius4/events{/privacy}","received_events_url":"https://api.github.com/users/alan-agius4/received_events","type":"User","site_admin":false},"body":"Do you know any other way to get the `moduleName` other than\r\n\r\n```ts\r\nconst signature = checker.typeChecker.getResolvedSignature(node);\r\nconst file = signature.getDeclaration().getSourceFile().moduleName;\r\n```\r\n\r\nAs the moduleName here it always being returned `undefined`, but If I try to use `.fileName` instead I get the correct file path. \r\n\r\nCause I was not going to do something like;\r\n\r\n```ts\r\nconst signature = checker.typeChecker.getResolvedSignature(node);\r\nconst file = signature.getDeclaration().getSourceFile().fileName;\r\n\r\nif (file.indexOf('jasmine') >= 0  && node.getText() === 'it') \r\n```\r\n\r\nI don't like the indexOf implementation that much, but cannot find a way to get the moduleName since it's being returned undefined.","created_at":"2018-04-05T18:33:21Z","updated_at":"2018-04-05T18:33:21Z","html_url":"https://github.com/bazelbuild/rules_typescript/pull/184#discussion_r179560328","pull_request_url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/comments/179560328"},"html":{"href":"https://github.com/bazelbuild/rules_typescript/pull/184#discussion_r179560328"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184"}},"in_reply_to_id":179511843},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184","id":179353102,"html_url":"https://github.com/bazelbuild/rules_typescript/pull/184","diff_url":"https://github.com/bazelbuild/rules_typescript/pull/184.diff","patch_url":"https://github.com/bazelbuild/rules_typescript/pull/184.patch","issue_url":"https://api.github.com/repos/bazelbuild/rules_typescript/issues/184","number":184,"state":"open","locked":false,"title":"feat(tsetse): add `ban_nested_it` rules","user":{"login":"alan-agius4","id":17563226,"avatar_url":"https://avatars3.githubusercontent.com/u/17563226?v=4","gravatar_id":"","url":"https://api.github.com/users/alan-agius4","html_url":"https://github.com/alan-agius4","followers_url":"https://api.github.com/users/alan-agius4/followers","following_url":"https://api.github.com/users/alan-agius4/following{/other_user}","gists_url":"https://api.github.com/users/alan-agius4/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-agius4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-agius4/subscriptions","organizations_url":"https://api.github.com/users/alan-agius4/orgs","repos_url":"https://api.github.com/users/alan-agius4/repos","events_url":"https://api.github.com/users/alan-agius4/events{/privacy}","received_events_url":"https://api.github.com/users/alan-agius4/received_events","type":"User","site_admin":false},"body":"Bans nested 'it' methods,  as these cause falsy positive in unit tests.\r\n\r\nTo test It I modified the BUILD.bazel to \r\n```ts\r\nts_library(\r\n    name = \"test_lib\",\r\n    srcs = glob([\"tsetse/tests/ban_nested_it/*.ts\"]),\r\n    tsconfig = \"//internal:tsc_wrapped/tsconfig.json\",\r\n)\r\n```\r\n\r\nAs it seems that `tsetse/tests` are being ignored from `bazel test`\r\n\r\nThis is following a convo with @alexeagle  in https://github.com/angular/angular/pull/23153, couldn't help it in trying to create a rule :)","created_at":"2018-04-04T10:56:09Z","updated_at":"2018-04-05T18:33:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3339e78e8de464859cce4b95c3852d8505eb7e5f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":698439694,"url":"https://api.github.com/repos/bazelbuild/rules_typescript/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184/comments","review_comment_url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazelbuild/rules_typescript/issues/184/comments","statuses_url":"https://api.github.com/repos/bazelbuild/rules_typescript/statuses/268fedf4511c84ac331809afc919d85fc4990cbe","head":{"label":"alan-agius4:feature/ban_nested_it","ref":"feature/ban_nested_it","sha":"268fedf4511c84ac331809afc919d85fc4990cbe","user":{"login":"alan-agius4","id":17563226,"avatar_url":"https://avatars3.githubusercontent.com/u/17563226?v=4","gravatar_id":"","url":"https://api.github.com/users/alan-agius4","html_url":"https://github.com/alan-agius4","followers_url":"https://api.github.com/users/alan-agius4/followers","following_url":"https://api.github.com/users/alan-agius4/following{/other_user}","gists_url":"https://api.github.com/users/alan-agius4/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-agius4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-agius4/subscriptions","organizations_url":"https://api.github.com/users/alan-agius4/orgs","repos_url":"https://api.github.com/users/alan-agius4/repos","events_url":"https://api.github.com/users/alan-agius4/events{/privacy}","received_events_url":"https://api.github.com/users/alan-agius4/received_events","type":"User","site_admin":false},"repo":{"id":127977974,"name":"rules_typescript","full_name":"alan-agius4/rules_typescript","owner":{"login":"alan-agius4","id":17563226,"avatar_url":"https://avatars3.githubusercontent.com/u/17563226?v=4","gravatar_id":"","url":"https://api.github.com/users/alan-agius4","html_url":"https://github.com/alan-agius4","followers_url":"https://api.github.com/users/alan-agius4/followers","following_url":"https://api.github.com/users/alan-agius4/following{/other_user}","gists_url":"https://api.github.com/users/alan-agius4/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-agius4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-agius4/subscriptions","organizations_url":"https://api.github.com/users/alan-agius4/orgs","repos_url":"https://api.github.com/users/alan-agius4/repos","events_url":"https://api.github.com/users/alan-agius4/events{/privacy}","received_events_url":"https://api.github.com/users/alan-agius4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alan-agius4/rules_typescript","description":"Build TypeScript code with Bazel","fork":true,"url":"https://api.github.com/repos/alan-agius4/rules_typescript","forks_url":"https://api.github.com/repos/alan-agius4/rules_typescript/forks","keys_url":"https://api.github.com/repos/alan-agius4/rules_typescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alan-agius4/rules_typescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alan-agius4/rules_typescript/teams","hooks_url":"https://api.github.com/repos/alan-agius4/rules_typescript/hooks","issue_events_url":"https://api.github.com/repos/alan-agius4/rules_typescript/issues/events{/number}","events_url":"https://api.github.com/repos/alan-agius4/rules_typescript/events","assignees_url":"https://api.github.com/repos/alan-agius4/rules_typescript/assignees{/user}","branches_url":"https://api.github.com/repos/alan-agius4/rules_typescript/branches{/branch}","tags_url":"https://api.github.com/repos/alan-agius4/rules_typescript/tags","blobs_url":"https://api.github.com/repos/alan-agius4/rules_typescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alan-agius4/rules_typescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alan-agius4/rules_typescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/alan-agius4/rules_typescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alan-agius4/rules_typescript/statuses/{sha}","languages_url":"https://api.github.com/repos/alan-agius4/rules_typescript/languages","stargazers_url":"https://api.github.com/repos/alan-agius4/rules_typescript/stargazers","contributors_url":"https://api.github.com/repos/alan-agius4/rules_typescript/contributors","subscribers_url":"https://api.github.com/repos/alan-agius4/rules_typescript/subscribers","subscription_url":"https://api.github.com/repos/alan-agius4/rules_typescript/subscription","commits_url":"https://api.github.com/repos/alan-agius4/rules_typescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/alan-agius4/rules_typescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/alan-agius4/rules_typescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/alan-agius4/rules_typescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/alan-agius4/rules_typescript/contents/{+path}","compare_url":"https://api.github.com/repos/alan-agius4/rules_typescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alan-agius4/rules_typescript/merges","archive_url":"https://api.github.com/repos/alan-agius4/rules_typescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alan-agius4/rules_typescript/downloads","issues_url":"https://api.github.com/repos/alan-agius4/rules_typescript/issues{/number}","pulls_url":"https://api.github.com/repos/alan-agius4/rules_typescript/pulls{/number}","milestones_url":"https://api.github.com/repos/alan-agius4/rules_typescript/milestones{/number}","notifications_url":"https://api.github.com/repos/alan-agius4/rules_typescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alan-agius4/rules_typescript/labels{/name}","releases_url":"https://api.github.com/repos/alan-agius4/rules_typescript/releases{/id}","deployments_url":"https://api.github.com/repos/alan-agius4/rules_typescript/deployments","created_at":"2018-04-03T22:55:43Z","updated_at":"2018-04-03T22:55:45Z","pushed_at":"2018-04-05T15:58:07Z","git_url":"git://github.com/alan-agius4/rules_typescript.git","ssh_url":"git@github.com:alan-agius4/rules_typescript.git","clone_url":"https://github.com/alan-agius4/rules_typescript.git","svn_url":"https://github.com/alan-agius4/rules_typescript","homepage":"","size":430,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"4aedc56b1f737bbd8ef5a6dc30889df3d392efa1","user":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":92074256,"name":"rules_typescript","full_name":"bazelbuild/rules_typescript","owner":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazelbuild/rules_typescript","description":"Build TypeScript code with Bazel","fork":false,"url":"https://api.github.com/repos/bazelbuild/rules_typescript","forks_url":"https://api.github.com/repos/bazelbuild/rules_typescript/forks","keys_url":"https://api.github.com/repos/bazelbuild/rules_typescript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazelbuild/rules_typescript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazelbuild/rules_typescript/teams","hooks_url":"https://api.github.com/repos/bazelbuild/rules_typescript/hooks","issue_events_url":"https://api.github.com/repos/bazelbuild/rules_typescript/issues/events{/number}","events_url":"https://api.github.com/repos/bazelbuild/rules_typescript/events","assignees_url":"https://api.github.com/repos/bazelbuild/rules_typescript/assignees{/user}","branches_url":"https://api.github.com/repos/bazelbuild/rules_typescript/branches{/branch}","tags_url":"https://api.github.com/repos/bazelbuild/rules_typescript/tags","blobs_url":"https://api.github.com/repos/bazelbuild/rules_typescript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazelbuild/rules_typescript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazelbuild/rules_typescript/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazelbuild/rules_typescript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazelbuild/rules_typescript/statuses/{sha}","languages_url":"https://api.github.com/repos/bazelbuild/rules_typescript/languages","stargazers_url":"https://api.github.com/repos/bazelbuild/rules_typescript/stargazers","contributors_url":"https://api.github.com/repos/bazelbuild/rules_typescript/contributors","subscribers_url":"https://api.github.com/repos/bazelbuild/rules_typescript/subscribers","subscription_url":"https://api.github.com/repos/bazelbuild/rules_typescript/subscription","commits_url":"https://api.github.com/repos/bazelbuild/rules_typescript/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazelbuild/rules_typescript/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazelbuild/rules_typescript/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazelbuild/rules_typescript/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazelbuild/rules_typescript/contents/{+path}","compare_url":"https://api.github.com/repos/bazelbuild/rules_typescript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazelbuild/rules_typescript/merges","archive_url":"https://api.github.com/repos/bazelbuild/rules_typescript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazelbuild/rules_typescript/downloads","issues_url":"https://api.github.com/repos/bazelbuild/rules_typescript/issues{/number}","pulls_url":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls{/number}","milestones_url":"https://api.github.com/repos/bazelbuild/rules_typescript/milestones{/number}","notifications_url":"https://api.github.com/repos/bazelbuild/rules_typescript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazelbuild/rules_typescript/labels{/name}","releases_url":"https://api.github.com/repos/bazelbuild/rules_typescript/releases{/id}","deployments_url":"https://api.github.com/repos/bazelbuild/rules_typescript/deployments","created_at":"2017-05-22T16:18:30Z","updated_at":"2018-04-03T17:01:15Z","pushed_at":"2018-04-05T15:58:08Z","git_url":"git://github.com/bazelbuild/rules_typescript.git","ssh_url":"git@github.com:bazelbuild/rules_typescript.git","clone_url":"https://github.com/bazelbuild/rules_typescript.git","svn_url":"https://github.com/bazelbuild/rules_typescript","homepage":"","size":427,"stargazers_count":85,"watchers_count":85,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":38,"mirror_url":null,"archived":false,"open_issues_count":64,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":38,"open_issues":64,"watchers":85,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184"},"html":{"href":"https://github.com/bazelbuild/rules_typescript/pull/184"},"issue":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/issues/184"},"comments":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/issues/184/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184/comments"},"review_comment":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/pulls/184/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/rules_typescript/statuses/268fedf4511c84ac331809afc919d85fc4990cbe"}},"author_association":"NONE"}}
{"actor":{"display_login":"alan-agius4"}}