{"action":"created","comment":{"url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/comments/76921847","id":76921847,"diff_hunk":"@@ -0,0 +1,61 @@\n+r\"\"\"Rule module.\n+\n+This module and sub-modules contain all the rules that can be applied\n+to the commit messages.\n+\n+\n+>>> good_message = '''fix(kgb): Make kgb reliable\n+...\n+... We used docstrings to keep the tests as close as possible to the codes.\n+... Look! That line was exactly 72 characters long!!!\n+... Yes I know that came at the price of an extra s at code.\n+... '''\n+\n+>>> bad_message = '''fixes(k g b): Make it quick and dirty, make it bads\n+... We try to make explanations as understandable as possible but we have some\n+... \\tissues with code consistency.'''\n+\n+>>> len(apply(good_message))\n+0\n+>>> len(apply(bad_message))\n+5\n+\"\"\"\n+\n+import re\n+from inspect import getmembers, isfunction\n+from . import line_rules\n+from . import raw_rules\n+from . import status_rules\n+\n+\n+def _get_rules(module):\n+    \"\"\"Get all functions from a module.\"\"\"\n+    return [tup[1] for tup in getmembers(module, isfunction)\n+            if tup[0][0] != \"_\"]\n+\n+_line_rules = _get_rules(line_rules)\n+_raw_rules = _get_rules(raw_rules)\n+_status_rules = _get_rules(status_rules)\n+\n+\n+def split_lines(commit_message):\n+    return re.split('\\r?\\n', commit_message)\n+\n+\n+def apply(commit_message):\n+    \"\"\"Apply all rules to the commit message.\"\"\"\n+    errors = []\n+    for rule in _raw_rules:\n+        err = rule(commit_message)\n+        if err is not None:\n+            errors.append(err)\n+    commit_lines = split_lines(commit_message)\n+    for rule in _status_rules:\n+        err = rule(commit_lines[0])\n+        if err is not None:\n+            errors.append(err)\n+    for check in _line_rules:\n+        err = check(commit_lines)\n+        if err is not None:\n+            errors.append(err)\n+    return(errors)","path":"kgbrules/__init__.py","position":61,"original_position":61,"commit_id":"4794ff5f80d1701dd5b85bc58e7a0abbf2acfd26","original_commit_id":"4794ff5f80d1701dd5b85bc58e7a0abbf2acfd26","user":{"login":"SagaStalin","id":18303362,"avatar_url":"https://avatars.githubusercontent.com/u/18303362?v=3","gravatar_id":"","url":"https://api.github.com/users/SagaStalin","html_url":"https://github.com/SagaStalin","followers_url":"https://api.github.com/users/SagaStalin/followers","following_url":"https://api.github.com/users/SagaStalin/following{/other_user}","gists_url":"https://api.github.com/users/SagaStalin/gists{/gist_id}","starred_url":"https://api.github.com/users/SagaStalin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SagaStalin/subscriptions","organizations_url":"https://api.github.com/users/SagaStalin/orgs","repos_url":"https://api.github.com/users/SagaStalin/repos","events_url":"https://api.github.com/users/SagaStalin/events{/privacy}","received_events_url":"https://api.github.com/users/SagaStalin/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Remove the parentheses after this \"return\" keyword [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.sagacify.com/coding_rules#rule_key=python%3AS1721)\n![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Remove those useless parentheses [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.sagacify.com/coding_rules#rule_key=python%3AS1110)\n![MINOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-minor.png) Unnecessary parens after 'return' keyword [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.sagacify.com/coding_rules#rule_key=Pylint%3AC0325)\n","created_at":"2016-08-31T04:12:40Z","updated_at":"2016-08-31T04:12:40Z","html_url":"https://github.com/Sagacify/kgb-rules/pull/1#discussion_r76921847","pull_request_url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/comments/76921847"},"html":{"href":"https://github.com/Sagacify/kgb-rules/pull/1#discussion_r76921847"},"pull_request":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1","id":83328664,"html_url":"https://github.com/Sagacify/kgb-rules/pull/1","diff_url":"https://github.com/Sagacify/kgb-rules/pull/1.diff","patch_url":"https://github.com/Sagacify/kgb-rules/pull/1.patch","issue_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues/1","number":1,"state":"open","locked":false,"title":"Seperate KGB-server and KGB rules to allow git commit hook creation","user":{"login":"aborsu","id":5033617,"avatar_url":"https://avatars.githubusercontent.com/u/5033617?v=3","gravatar_id":"","url":"https://api.github.com/users/aborsu","html_url":"https://github.com/aborsu","followers_url":"https://api.github.com/users/aborsu/followers","following_url":"https://api.github.com/users/aborsu/following{/other_user}","gists_url":"https://api.github.com/users/aborsu/gists{/gist_id}","starred_url":"https://api.github.com/users/aborsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aborsu/subscriptions","organizations_url":"https://api.github.com/users/aborsu/orgs","repos_url":"https://api.github.com/users/aborsu/repos","events_url":"https://api.github.com/users/aborsu/events{/privacy}","received_events_url":"https://api.github.com/users/aborsu/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-08-30T19:07:08Z","updated_at":"2016-08-31T04:12:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7fa453b6e78a36d6d8aa131f4622d34b59eb964","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues/1/comments","statuses_url":"https://api.github.com/repos/Sagacify/kgb-rules/statuses/4794ff5f80d1701dd5b85bc58e7a0abbf2acfd26","head":{"label":"Sagacify:staging","ref":"staging","sha":"4794ff5f80d1701dd5b85bc58e7a0abbf2acfd26","user":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"repo":{"id":66966899,"name":"kgb-rules","full_name":"Sagacify/kgb-rules","owner":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sagacify/kgb-rules","description":"Правила Комитета Git'a Безопасности","fork":false,"url":"https://api.github.com/repos/Sagacify/kgb-rules","forks_url":"https://api.github.com/repos/Sagacify/kgb-rules/forks","keys_url":"https://api.github.com/repos/Sagacify/kgb-rules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sagacify/kgb-rules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sagacify/kgb-rules/teams","hooks_url":"https://api.github.com/repos/Sagacify/kgb-rules/hooks","issue_events_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues/events{/number}","events_url":"https://api.github.com/repos/Sagacify/kgb-rules/events","assignees_url":"https://api.github.com/repos/Sagacify/kgb-rules/assignees{/user}","branches_url":"https://api.github.com/repos/Sagacify/kgb-rules/branches{/branch}","tags_url":"https://api.github.com/repos/Sagacify/kgb-rules/tags","blobs_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sagacify/kgb-rules/statuses/{sha}","languages_url":"https://api.github.com/repos/Sagacify/kgb-rules/languages","stargazers_url":"https://api.github.com/repos/Sagacify/kgb-rules/stargazers","contributors_url":"https://api.github.com/repos/Sagacify/kgb-rules/contributors","subscribers_url":"https://api.github.com/repos/Sagacify/kgb-rules/subscribers","subscription_url":"https://api.github.com/repos/Sagacify/kgb-rules/subscription","commits_url":"https://api.github.com/repos/Sagacify/kgb-rules/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sagacify/kgb-rules/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sagacify/kgb-rules/contents/{+path}","compare_url":"https://api.github.com/repos/Sagacify/kgb-rules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sagacify/kgb-rules/merges","archive_url":"https://api.github.com/repos/Sagacify/kgb-rules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sagacify/kgb-rules/downloads","issues_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues{/number}","pulls_url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls{/number}","milestones_url":"https://api.github.com/repos/Sagacify/kgb-rules/milestones{/number}","notifications_url":"https://api.github.com/repos/Sagacify/kgb-rules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sagacify/kgb-rules/labels{/name}","releases_url":"https://api.github.com/repos/Sagacify/kgb-rules/releases{/id}","deployments_url":"https://api.github.com/repos/Sagacify/kgb-rules/deployments","created_at":"2016-08-30T18:28:38Z","updated_at":"2016-08-30T18:28:38Z","pushed_at":"2016-08-31T04:10:29Z","git_url":"git://github.com/Sagacify/kgb-rules.git","ssh_url":"git@github.com:Sagacify/kgb-rules.git","clone_url":"https://github.com/Sagacify/kgb-rules.git","svn_url":"https://github.com/Sagacify/kgb-rules","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Sagacify:master","ref":"master","sha":"4ef607a1918da0f3cd110716a839c3c58465bbc3","user":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"repo":{"id":66966899,"name":"kgb-rules","full_name":"Sagacify/kgb-rules","owner":{"login":"Sagacify","id":1648230,"avatar_url":"https://avatars.githubusercontent.com/u/1648230?v=3","gravatar_id":"","url":"https://api.github.com/users/Sagacify","html_url":"https://github.com/Sagacify","followers_url":"https://api.github.com/users/Sagacify/followers","following_url":"https://api.github.com/users/Sagacify/following{/other_user}","gists_url":"https://api.github.com/users/Sagacify/gists{/gist_id}","starred_url":"https://api.github.com/users/Sagacify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sagacify/subscriptions","organizations_url":"https://api.github.com/users/Sagacify/orgs","repos_url":"https://api.github.com/users/Sagacify/repos","events_url":"https://api.github.com/users/Sagacify/events{/privacy}","received_events_url":"https://api.github.com/users/Sagacify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sagacify/kgb-rules","description":"Правила Комитета Git'a Безопасности","fork":false,"url":"https://api.github.com/repos/Sagacify/kgb-rules","forks_url":"https://api.github.com/repos/Sagacify/kgb-rules/forks","keys_url":"https://api.github.com/repos/Sagacify/kgb-rules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sagacify/kgb-rules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sagacify/kgb-rules/teams","hooks_url":"https://api.github.com/repos/Sagacify/kgb-rules/hooks","issue_events_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues/events{/number}","events_url":"https://api.github.com/repos/Sagacify/kgb-rules/events","assignees_url":"https://api.github.com/repos/Sagacify/kgb-rules/assignees{/user}","branches_url":"https://api.github.com/repos/Sagacify/kgb-rules/branches{/branch}","tags_url":"https://api.github.com/repos/Sagacify/kgb-rules/tags","blobs_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sagacify/kgb-rules/statuses/{sha}","languages_url":"https://api.github.com/repos/Sagacify/kgb-rules/languages","stargazers_url":"https://api.github.com/repos/Sagacify/kgb-rules/stargazers","contributors_url":"https://api.github.com/repos/Sagacify/kgb-rules/contributors","subscribers_url":"https://api.github.com/repos/Sagacify/kgb-rules/subscribers","subscription_url":"https://api.github.com/repos/Sagacify/kgb-rules/subscription","commits_url":"https://api.github.com/repos/Sagacify/kgb-rules/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sagacify/kgb-rules/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sagacify/kgb-rules/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sagacify/kgb-rules/contents/{+path}","compare_url":"https://api.github.com/repos/Sagacify/kgb-rules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sagacify/kgb-rules/merges","archive_url":"https://api.github.com/repos/Sagacify/kgb-rules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sagacify/kgb-rules/downloads","issues_url":"https://api.github.com/repos/Sagacify/kgb-rules/issues{/number}","pulls_url":"https://api.github.com/repos/Sagacify/kgb-rules/pulls{/number}","milestones_url":"https://api.github.com/repos/Sagacify/kgb-rules/milestones{/number}","notifications_url":"https://api.github.com/repos/Sagacify/kgb-rules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sagacify/kgb-rules/labels{/name}","releases_url":"https://api.github.com/repos/Sagacify/kgb-rules/releases{/id}","deployments_url":"https://api.github.com/repos/Sagacify/kgb-rules/deployments","created_at":"2016-08-30T18:28:38Z","updated_at":"2016-08-30T18:28:38Z","pushed_at":"2016-08-31T04:10:29Z","git_url":"git://github.com/Sagacify/kgb-rules.git","ssh_url":"git@github.com:Sagacify/kgb-rules.git","clone_url":"https://github.com/Sagacify/kgb-rules.git","svn_url":"https://github.com/Sagacify/kgb-rules","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1"},"html":{"href":"https://github.com/Sagacify/kgb-rules/pull/1"},"issue":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/issues/1"},"comments":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Sagacify/kgb-rules/statuses/4794ff5f80d1701dd5b85bc58e7a0abbf2acfd26"}}}}
{"actor":{"display_login":"SagaStalin"}}