{"action":"created","comment":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/51195901","id":51195901,"diff_hunk":"@@ -0,0 +1,34 @@\n+import os\n+import subprocess\n+\n+import re\n+MAX_LANG_WIDTH = 20\n+FNULL = open(os.devnull, 'w')\n+WARNING_FORMAT = ('%s - %s does not match a regulation, '\n+                  'please change \"%s\" to \"[SEPARATE]%s\".\\n')\n+\n+def check_guidelines(language, base_path):\n+  padded_language = (\"[\" + language + \"]\").ljust(MAX_LANG_WIDTH +2)\n+  with open(base_path + \"/wca-guidelines.md\") as guidelines:\n+    warnings = \"\"\n+    for item in guidelines:\n+      # Only match the lines starting with something like \"- A1b++)\" (guidelines),\n+      # which don't have the \"SEPARATE\" label.\n+      match_result = re.match(r\"- (\\w+)(\\++)\\) (?!\\[SEPARATE\\])(\\[[^\\[\\]]+\\])\", item)\n+      if match_result is None:\n+        continue\n+      # Extract the regulation we want to look for\n+      # '0' is the full match, '1' is the first subgroup (regulation), '2' is the subnumber","path":"regulations/check_missing.py","position":21,"original_position":21,"commit_id":"23d77406eb82afce4ca8a1784799e319bd8f255d","original_commit_id":"23d77406eb82afce4ca8a1784799e319bd8f255d","user":{"login":"viroulep","id":1007485,"avatar_url":"https://avatars.githubusercontent.com/u/1007485?v=3","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"body":"I have no idea about tuple unpacking vs naming tbh, but it would indeed make the regex more readable !","created_at":"2016-01-28T22:09:37Z","updated_at":"2016-01-28T22:09:37Z","html_url":"https://github.com/cubing/worldcubeassociation.org/pull/351#discussion_r51195901","pull_request_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351","_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/51195901"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/351#discussion_r51195901"},"pull_request":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351"}}},"pull_request":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351","id":57363186,"html_url":"https://github.com/cubing/worldcubeassociation.org/pull/351","diff_url":"https://github.com/cubing/worldcubeassociation.org/pull/351.diff","patch_url":"https://github.com/cubing/worldcubeassociation.org/pull/351.patch","issue_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/351","number":351,"state":"open","locked":false,"title":"Added a check pass to the regulations build system.","user":{"login":"viroulep","id":1007485,"avatar_url":"https://avatars.githubusercontent.com/u/1007485?v=3","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"body":"This is related to cubing/wca-regulations#319.\r\nWe want guidelines refering to non-existent regulations to have the \"SEPARATE\" label.\r\nThis commit adds a check pass before each html build, displaying a warning for any missing or misused \"SEPARATE\" label.\r\n\r\nRight now the output looks like this : \r\n```\r\n...\r\n[portuguese-brazilian] Warnings for the Guidelines :\r\n[portuguese-brazilian] - 6a+ does not match a regulation, please change \"[SEPARADO]\" to \"[SEPARATE][SEPARADO]\".\r\n...\r\n[english]              Warnings for the Guidelines :\r\n[english]              - 4b4+ does not match a regulation, please change \"[ADDITION]\" to \"[SEPARATE][ADDITION]\".\r\n[english]              - 5c+ does not match a regulation, please change \"[REMINDER]\" to \"[SEPARATE][REMINDER]\".\r\n[english]              - D1c+ does not match a regulation, please change \"[REMINDER]\" to \"[SEPARATE][REMINDER]\".\r\n[english]              Generating HTML in ./build/regulations/\r\n[russian]              Warnings for the Guidelines :\r\n[russian]              - 4b4+ does not match a regulation, please change \"[ДОПОЛНЕНИЕ]\" to \"[SEPARATE][ДОПОЛНЕНИЕ]\".\r\n[russian]              - 6a+ does not match a regulation, please change \"[ВЫДЕЛЕНО]\" to \"[SEPARATE][ВЫДЕЛЕНО]\".\r\n...\r\n[russian]              Generating HTML in ./build/regulations/translations/russian/\r\n...\r\n```\r\n\r\nA lot of translations are missing (or translated) the labels, so right now the output of the regulations build is kind of big :s\r\n\r\nHow does it look ?","created_at":"2016-01-27T14:00:41Z","updated_at":"2016-01-28T22:09:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ed3852ab39d1c46f50556597e5fc2722025e9271","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351/commits","review_comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351/comments","review_comment_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/351/comments","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/23d77406eb82afce4ca8a1784799e319bd8f255d","head":{"label":"viroulep:check_missing_guidelines","ref":"check_missing_guidelines","sha":"23d77406eb82afce4ca8a1784799e319bd8f255d","user":{"login":"viroulep","id":1007485,"avatar_url":"https://avatars.githubusercontent.com/u/1007485?v=3","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"repo":{"id":49994335,"name":"worldcubeassociation.org","full_name":"viroulep/worldcubeassociation.org","owner":{"login":"viroulep","id":1007485,"avatar_url":"https://avatars.githubusercontent.com/u/1007485?v=3","gravatar_id":"","url":"https://api.github.com/users/viroulep","html_url":"https://github.com/viroulep","followers_url":"https://api.github.com/users/viroulep/followers","following_url":"https://api.github.com/users/viroulep/following{/other_user}","gists_url":"https://api.github.com/users/viroulep/gists{/gist_id}","starred_url":"https://api.github.com/users/viroulep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viroulep/subscriptions","organizations_url":"https://api.github.com/users/viroulep/orgs","repos_url":"https://api.github.com/users/viroulep/repos","events_url":"https://api.github.com/users/viroulep/events{/privacy}","received_events_url":"https://api.github.com/users/viroulep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/viroulep/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":true,"url":"https://api.github.com/repos/viroulep/worldcubeassociation.org","forks_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/viroulep/worldcubeassociation.org/deployments","created_at":"2016-01-20T01:01:37Z","updated_at":"2016-01-20T01:01:44Z","pushed_at":"2016-01-27T14:29:01Z","git_url":"git://github.com/viroulep/worldcubeassociation.org.git","ssh_url":"git@github.com:viroulep/worldcubeassociation.org.git","clone_url":"https://github.com/viroulep/worldcubeassociation.org.git","svn_url":"https://github.com/viroulep/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":49748,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"cubing:master","ref":"master","sha":"e316c86ae166bd52bfdf2cc8bf804fcbcc42a49c","user":{"login":"cubing","id":1092267,"avatar_url":"https://avatars.githubusercontent.com/u/1092267?v=3","gravatar_id":"","url":"https://api.github.com/users/cubing","html_url":"https://github.com/cubing","followers_url":"https://api.github.com/users/cubing/followers","following_url":"https://api.github.com/users/cubing/following{/other_user}","gists_url":"https://api.github.com/users/cubing/gists{/gist_id}","starred_url":"https://api.github.com/users/cubing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubing/subscriptions","organizations_url":"https://api.github.com/users/cubing/orgs","repos_url":"https://api.github.com/users/cubing/repos","events_url":"https://api.github.com/users/cubing/events{/privacy}","received_events_url":"https://api.github.com/users/cubing/received_events","type":"Organization","site_admin":false},"repo":{"id":34161579,"name":"worldcubeassociation.org","full_name":"cubing/worldcubeassociation.org","owner":{"login":"cubing","id":1092267,"avatar_url":"https://avatars.githubusercontent.com/u/1092267?v=3","gravatar_id":"","url":"https://api.github.com/users/cubing","html_url":"https://github.com/cubing","followers_url":"https://api.github.com/users/cubing/followers","following_url":"https://api.github.com/users/cubing/following{/other_user}","gists_url":"https://api.github.com/users/cubing/gists{/gist_id}","starred_url":"https://api.github.com/users/cubing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubing/subscriptions","organizations_url":"https://api.github.com/users/cubing/orgs","repos_url":"https://api.github.com/users/cubing/repos","events_url":"https://api.github.com/users/cubing/events{/privacy}","received_events_url":"https://api.github.com/users/cubing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cubing/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":false,"url":"https://api.github.com/repos/cubing/worldcubeassociation.org","forks_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/deployments","created_at":"2015-04-18T10:21:53Z","updated_at":"2016-01-19T22:28:28Z","pushed_at":"2016-01-28T21:53:20Z","git_url":"git://github.com/cubing/worldcubeassociation.org.git","ssh_url":"git@github.com:cubing/worldcubeassociation.org.git","clone_url":"https://github.com/cubing/worldcubeassociation.org.git","svn_url":"https://github.com/cubing/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":50043,"stargazers_count":6,"watchers_count":6,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":126,"forks":16,"open_issues":126,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/351"},"issue":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/351"},"comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/351/comments"},"review_comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351/comments"},"review_comment":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/351/commits"},"statuses":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/23d77406eb82afce4ca8a1784799e319bd8f255d"}}}}