{"action":"created","comment":{"url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/comments/59138218","id":59138218,"diff_hunk":"@@ -110,6 +118,45 @@ def check_shortlog(self,\n                     self,\n                     \"Shortlog of HEAD commit does not match given regex.\")\n \n+        if shortlog_imperative_check:\n+            colon_pos = shortlog.find(':')\n+            shortlog = shortlog[colon_pos + 1:] if colon_pos != -1 else shortlog\n+            has_flaws = self.check_imperative(shortlog)\n+            if has_flaws:\n+                bad_words = ', '.join(map(itemgetter(0), has_flaws))\n+                yield Result(self,\n+                             \"Shortlog of HEAD commit isn't imperative mood, \"\n+                             \"bad words are '{}'\".format(bad_words))\n+\n+    def check_imperative(self, paragraph):\n+        \"\"\"\n+        Check the given sentence/s for Imperatives.\n+\n+        :param paragraph:\n+            The input paragraph to be tested.\n+        :returns:\n+            A list of tuples having 2 elements (invalid word, parts of speech)\n+            or an empty list if no invalid words are found.\n+        \"\"\"\n+        try:\n+            words = nltk.word_tokenize(nltk.sent_tokenize(paragraph)[0])\n+            flaws = []\n+            # VBZ : Verb, 3rd person singular present, like 'adds', 'writes' etc\n+            # VBD : Verb, Past tense , like 'added', 'wrote' etc\n+            # VBG : Verb, Present participle, like 'adding', 'writing'\n+            for word, tag in nltk.pos_tag(['I'] + words)[1:2]:\n+                if(tag.startswith('VBZ') or\n+                   tag.startswith('VBD') or\n+                   tag.startswith('VBG') or\n+                   word.endswith('ing')):  # Handle special case for VBG\n+                    flaws.append((word, tag))\n+            return flaws\n+        except LookupError as error:    # pragma: no cover","path":"bears/vcs/git/GitCommitBear.py","position":82,"original_position":82,"commit_id":"a81f4777f0679456ea1bfbc6fd0834119dff615d","original_commit_id":"a81f4777f0679456ea1bfbc6fd0834119dff615d","user":{"login":"sils1297","id":5716520,"avatar_url":"https://avatars.githubusercontent.com/u/5716520?v=3","gravatar_id":"","url":"https://api.github.com/users/sils1297","html_url":"https://github.com/sils1297","followers_url":"https://api.github.com/users/sils1297/followers","following_url":"https://api.github.com/users/sils1297/following{/other_user}","gists_url":"https://api.github.com/users/sils1297/gists{/gist_id}","starred_url":"https://api.github.com/users/sils1297/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sils1297/subscriptions","organizations_url":"https://api.github.com/users/sils1297/orgs","repos_url":"https://api.github.com/users/sils1297/repos","events_url":"https://api.github.com/users/sils1297/events{/privacy}","received_events_url":"https://api.github.com/users/sils1297/received_events","type":"User","site_admin":false},"body":"a space before # too much","created_at":"2016-04-10T18:05:03Z","updated_at":"2016-04-10T18:05:03Z","html_url":"https://github.com/coala-analyzer/coala-bears/pull/315#discussion_r59138218","pull_request_url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315","_links":{"self":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/comments/59138218"},"html":{"href":"https://github.com/coala-analyzer/coala-bears/pull/315#discussion_r59138218"},"pull_request":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315"}}},"pull_request":{"url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315","id":65036133,"html_url":"https://github.com/coala-analyzer/coala-bears/pull/315","diff_url":"https://github.com/coala-analyzer/coala-bears/pull/315.diff","patch_url":"https://github.com/coala-analyzer/coala-bears/pull/315.patch","issue_url":"https://api.github.com/repos/coala-analyzer/coala-bears/issues/315","number":315,"state":"open","locked":false,"title":"GitCommitBear: Add imperative check in shortlog","user":{"login":"tushar-rishav","id":7397433,"avatar_url":"https://avatars.githubusercontent.com/u/7397433?v=3","gravatar_id":"","url":"https://api.github.com/users/tushar-rishav","html_url":"https://github.com/tushar-rishav","followers_url":"https://api.github.com/users/tushar-rishav/followers","following_url":"https://api.github.com/users/tushar-rishav/following{/other_user}","gists_url":"https://api.github.com/users/tushar-rishav/gists{/gist_id}","starred_url":"https://api.github.com/users/tushar-rishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tushar-rishav/subscriptions","organizations_url":"https://api.github.com/users/tushar-rishav/orgs","repos_url":"https://api.github.com/users/tushar-rishav/repos","events_url":"https://api.github.com/users/tushar-rishav/events{/privacy}","received_events_url":"https://api.github.com/users/tushar-rishav/received_events","type":"User","site_admin":false},"body":"This commit adds `check_imperative` method in `GitCommitBear`.\r\nThe method checks if a shortlog is in imperative mood or not.\r\nIf the shortlog isn't in imperative mood then it'd throw an error\r\nmessage including the invalid words that are the cause for being non\r\nimperative so that user could get some hint and fix his commit.\r\n\r\nFixes https://github.com/coala-analyzer/coala-bears/issues/243","created_at":"2016-04-02T11:58:39Z","updated_at":"2016-04-10T18:05:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aaebc7cd772077611c6b66a9ce9a54ba6bdce242","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315/commits","review_comments_url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315/comments","review_comment_url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coala-analyzer/coala-bears/issues/315/comments","statuses_url":"https://api.github.com/repos/coala-analyzer/coala-bears/statuses/a81f4777f0679456ea1bfbc6fd0834119dff615d","head":{"label":"tushar-rishav:243","ref":"243","sha":"a81f4777f0679456ea1bfbc6fd0834119dff615d","user":{"login":"tushar-rishav","id":7397433,"avatar_url":"https://avatars.githubusercontent.com/u/7397433?v=3","gravatar_id":"","url":"https://api.github.com/users/tushar-rishav","html_url":"https://github.com/tushar-rishav","followers_url":"https://api.github.com/users/tushar-rishav/followers","following_url":"https://api.github.com/users/tushar-rishav/following{/other_user}","gists_url":"https://api.github.com/users/tushar-rishav/gists{/gist_id}","starred_url":"https://api.github.com/users/tushar-rishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tushar-rishav/subscriptions","organizations_url":"https://api.github.com/users/tushar-rishav/orgs","repos_url":"https://api.github.com/users/tushar-rishav/repos","events_url":"https://api.github.com/users/tushar-rishav/events{/privacy}","received_events_url":"https://api.github.com/users/tushar-rishav/received_events","type":"User","site_admin":false},"repo":{"id":52209680,"name":"coala-bears","full_name":"tushar-rishav/coala-bears","owner":{"login":"tushar-rishav","id":7397433,"avatar_url":"https://avatars.githubusercontent.com/u/7397433?v=3","gravatar_id":"","url":"https://api.github.com/users/tushar-rishav","html_url":"https://github.com/tushar-rishav","followers_url":"https://api.github.com/users/tushar-rishav/followers","following_url":"https://api.github.com/users/tushar-rishav/following{/other_user}","gists_url":"https://api.github.com/users/tushar-rishav/gists{/gist_id}","starred_url":"https://api.github.com/users/tushar-rishav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tushar-rishav/subscriptions","organizations_url":"https://api.github.com/users/tushar-rishav/orgs","repos_url":"https://api.github.com/users/tushar-rishav/repos","events_url":"https://api.github.com/users/tushar-rishav/events{/privacy}","received_events_url":"https://api.github.com/users/tushar-rishav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tushar-rishav/coala-bears","description":"","fork":true,"url":"https://api.github.com/repos/tushar-rishav/coala-bears","forks_url":"https://api.github.com/repos/tushar-rishav/coala-bears/forks","keys_url":"https://api.github.com/repos/tushar-rishav/coala-bears/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tushar-rishav/coala-bears/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tushar-rishav/coala-bears/teams","hooks_url":"https://api.github.com/repos/tushar-rishav/coala-bears/hooks","issue_events_url":"https://api.github.com/repos/tushar-rishav/coala-bears/issues/events{/number}","events_url":"https://api.github.com/repos/tushar-rishav/coala-bears/events","assignees_url":"https://api.github.com/repos/tushar-rishav/coala-bears/assignees{/user}","branches_url":"https://api.github.com/repos/tushar-rishav/coala-bears/branches{/branch}","tags_url":"https://api.github.com/repos/tushar-rishav/coala-bears/tags","blobs_url":"https://api.github.com/repos/tushar-rishav/coala-bears/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tushar-rishav/coala-bears/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tushar-rishav/coala-bears/git/refs{/sha}","trees_url":"https://api.github.com/repos/tushar-rishav/coala-bears/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tushar-rishav/coala-bears/statuses/{sha}","languages_url":"https://api.github.com/repos/tushar-rishav/coala-bears/languages","stargazers_url":"https://api.github.com/repos/tushar-rishav/coala-bears/stargazers","contributors_url":"https://api.github.com/repos/tushar-rishav/coala-bears/contributors","subscribers_url":"https://api.github.com/repos/tushar-rishav/coala-bears/subscribers","subscription_url":"https://api.github.com/repos/tushar-rishav/coala-bears/subscription","commits_url":"https://api.github.com/repos/tushar-rishav/coala-bears/commits{/sha}","git_commits_url":"https://api.github.com/repos/tushar-rishav/coala-bears/git/commits{/sha}","comments_url":"https://api.github.com/repos/tushar-rishav/coala-bears/comments{/number}","issue_comment_url":"https://api.github.com/repos/tushar-rishav/coala-bears/issues/comments{/number}","contents_url":"https://api.github.com/repos/tushar-rishav/coala-bears/contents/{+path}","compare_url":"https://api.github.com/repos/tushar-rishav/coala-bears/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tushar-rishav/coala-bears/merges","archive_url":"https://api.github.com/repos/tushar-rishav/coala-bears/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tushar-rishav/coala-bears/downloads","issues_url":"https://api.github.com/repos/tushar-rishav/coala-bears/issues{/number}","pulls_url":"https://api.github.com/repos/tushar-rishav/coala-bears/pulls{/number}","milestones_url":"https://api.github.com/repos/tushar-rishav/coala-bears/milestones{/number}","notifications_url":"https://api.github.com/repos/tushar-rishav/coala-bears/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tushar-rishav/coala-bears/labels{/name}","releases_url":"https://api.github.com/repos/tushar-rishav/coala-bears/releases{/id}","deployments_url":"https://api.github.com/repos/tushar-rishav/coala-bears/deployments","created_at":"2016-02-21T14:12:09Z","updated_at":"2016-02-21T14:12:10Z","pushed_at":"2016-04-10T10:41:43Z","git_url":"git://github.com/tushar-rishav/coala-bears.git","ssh_url":"git@github.com:tushar-rishav/coala-bears.git","clone_url":"https://github.com/tushar-rishav/coala-bears.git","svn_url":"https://github.com/tushar-rishav/coala-bears","homepage":null,"size":272,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"coala-analyzer:master","ref":"master","sha":"29c72ddb841fb8faebe8886961eae5106edd241c","user":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"repo":{"id":51688289,"name":"coala-bears","full_name":"coala-analyzer/coala-bears","owner":{"login":"coala-analyzer","id":10620750,"avatar_url":"https://avatars.githubusercontent.com/u/10620750?v=3","gravatar_id":"","url":"https://api.github.com/users/coala-analyzer","html_url":"https://github.com/coala-analyzer","followers_url":"https://api.github.com/users/coala-analyzer/followers","following_url":"https://api.github.com/users/coala-analyzer/following{/other_user}","gists_url":"https://api.github.com/users/coala-analyzer/gists{/gist_id}","starred_url":"https://api.github.com/users/coala-analyzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coala-analyzer/subscriptions","organizations_url":"https://api.github.com/users/coala-analyzer/orgs","repos_url":"https://api.github.com/users/coala-analyzer/repos","events_url":"https://api.github.com/users/coala-analyzer/events{/privacy}","received_events_url":"https://api.github.com/users/coala-analyzer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coala-analyzer/coala-bears","description":"Bears for coala","fork":false,"url":"https://api.github.com/repos/coala-analyzer/coala-bears","forks_url":"https://api.github.com/repos/coala-analyzer/coala-bears/forks","keys_url":"https://api.github.com/repos/coala-analyzer/coala-bears/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coala-analyzer/coala-bears/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coala-analyzer/coala-bears/teams","hooks_url":"https://api.github.com/repos/coala-analyzer/coala-bears/hooks","issue_events_url":"https://api.github.com/repos/coala-analyzer/coala-bears/issues/events{/number}","events_url":"https://api.github.com/repos/coala-analyzer/coala-bears/events","assignees_url":"https://api.github.com/repos/coala-analyzer/coala-bears/assignees{/user}","branches_url":"https://api.github.com/repos/coala-analyzer/coala-bears/branches{/branch}","tags_url":"https://api.github.com/repos/coala-analyzer/coala-bears/tags","blobs_url":"https://api.github.com/repos/coala-analyzer/coala-bears/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coala-analyzer/coala-bears/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coala-analyzer/coala-bears/git/refs{/sha}","trees_url":"https://api.github.com/repos/coala-analyzer/coala-bears/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coala-analyzer/coala-bears/statuses/{sha}","languages_url":"https://api.github.com/repos/coala-analyzer/coala-bears/languages","stargazers_url":"https://api.github.com/repos/coala-analyzer/coala-bears/stargazers","contributors_url":"https://api.github.com/repos/coala-analyzer/coala-bears/contributors","subscribers_url":"https://api.github.com/repos/coala-analyzer/coala-bears/subscribers","subscription_url":"https://api.github.com/repos/coala-analyzer/coala-bears/subscription","commits_url":"https://api.github.com/repos/coala-analyzer/coala-bears/commits{/sha}","git_commits_url":"https://api.github.com/repos/coala-analyzer/coala-bears/git/commits{/sha}","comments_url":"https://api.github.com/repos/coala-analyzer/coala-bears/comments{/number}","issue_comment_url":"https://api.github.com/repos/coala-analyzer/coala-bears/issues/comments{/number}","contents_url":"https://api.github.com/repos/coala-analyzer/coala-bears/contents/{+path}","compare_url":"https://api.github.com/repos/coala-analyzer/coala-bears/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coala-analyzer/coala-bears/merges","archive_url":"https://api.github.com/repos/coala-analyzer/coala-bears/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coala-analyzer/coala-bears/downloads","issues_url":"https://api.github.com/repos/coala-analyzer/coala-bears/issues{/number}","pulls_url":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls{/number}","milestones_url":"https://api.github.com/repos/coala-analyzer/coala-bears/milestones{/number}","notifications_url":"https://api.github.com/repos/coala-analyzer/coala-bears/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coala-analyzer/coala-bears/labels{/name}","releases_url":"https://api.github.com/repos/coala-analyzer/coala-bears/releases{/id}","deployments_url":"https://api.github.com/repos/coala-analyzer/coala-bears/deployments","created_at":"2016-02-14T09:25:11Z","updated_at":"2016-04-02T11:43:01Z","pushed_at":"2016-04-10T10:41:44Z","git_url":"git://github.com/coala-analyzer/coala-bears.git","ssh_url":"git@github.com:coala-analyzer/coala-bears.git","clone_url":"https://github.com/coala-analyzer/coala-bears.git","svn_url":"https://github.com/coala-analyzer/coala-bears","homepage":"http://coala-analyzer.org/","size":393,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":85,"forks":41,"open_issues":85,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315"},"html":{"href":"https://github.com/coala-analyzer/coala-bears/pull/315"},"issue":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/issues/315"},"comments":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/issues/315/comments"},"review_comments":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315/comments"},"review_comment":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/pulls/315/commits"},"statuses":{"href":"https://api.github.com/repos/coala-analyzer/coala-bears/statuses/a81f4777f0679456ea1bfbc6fd0834119dff615d"}}}}