{"action":"created","comment":{"url":"https://api.github.com/repos/edx/bok-choy/pulls/comments/40349789","id":40349789,"diff_hunk":"@@ -0,0 +1,239 @@\n+\"\"\"\n+Interface for using the google accessibility ruleset.\n+See: https://github.com/GoogleChrome/accessibility-developer-tools\n+\"\"\"\n+import json\n+import logging\n+import os\n+import requests\n+\n+from collections import namedtuple\n+from textwrap import dedent\n+\n+from .a11y_audit import A11yAudit, A11yAuditConfig, AccessibilityError\n+\n+log = logging.getLogger(__name__)\n+AuditResults = namedtuple('AuditResults', 'errors, warnings')\n+CUR_DIR = os.path.dirname(os.path.abspath(__file__))\n+\n+\n+class AxsAuditConfig(A11yAuditConfig):\n+    \"\"\"\n+    The `AxsAuditConfig` object defines the options available when\n+    running an `AxsAudit`.\n+    \"\"\"\n+    def __init__(self, *args, **kwargs):\n+        super(AxsAuditConfig, self).__init__(*args, **kwargs)\n+        self.rules_file = None\n+        self.scope, self.rules_to_run, self.rules_to_ignore = None, None, None\n+        self.rules_file = os.path.join(\n+            os.path.split(CUR_DIR)[0],\n+            'vendor/google/axs_testing.js'\n+        )\n+        self.set_rules([], ignore=False)\n+        self.set_rules([], ignore=True)\n+        self.set_scope()\n+\n+    def set_rules(self, rules, ignore=False, include_type=\"rule\"):\n+        \"\"\"\n+        Sets `rules_to_run` or `rules_to_ignore` to the passed list of rule IDs.\n+\n+        Args:\n+\n+            rules: List of rules to ignore or run for accessibility errors on\n+                the page. If `ignore=False`, an empty list means to check for\n+                all available rules and `None` means that no audit should be\n+                done for this page. If `ignore=True`, an empty list means to\n+                run rules all otherwise enabled rules and any rules listed here","path":"bok_choy/a11y/axs_ruleset.py","position":47,"original_position":47,"commit_id":"f09f39d75631144222075b694165d5899dd7629f","original_commit_id":"f09f39d75631144222075b694165d5899dd7629f","user":{"login":"jzoldak","id":2338889,"avatar_url":"https://avatars.githubusercontent.com/u/2338889?v=3","gravatar_id":"","url":"https://api.github.com/users/jzoldak","html_url":"https://github.com/jzoldak","followers_url":"https://api.github.com/users/jzoldak/followers","following_url":"https://api.github.com/users/jzoldak/following{/other_user}","gists_url":"https://api.github.com/users/jzoldak/gists{/gist_id}","starred_url":"https://api.github.com/users/jzoldak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzoldak/subscriptions","organizations_url":"https://api.github.com/users/jzoldak/orgs","repos_url":"https://api.github.com/users/jzoldak/repos","events_url":"https://api.github.com/users/jzoldak/events{/privacy}","received_events_url":"https://api.github.com/users/jzoldak/received_events","type":"User","site_admin":false},"body":"I think there's an extra word \"rules\" in this sentence.","created_at":"2015-09-24T17:55:36Z","updated_at":"2015-09-24T17:55:36Z","html_url":"https://github.com/edx/bok-choy/pull/109#discussion_r40349789","pull_request_url":"https://api.github.com/repos/edx/bok-choy/pulls/109","_links":{"self":{"href":"https://api.github.com/repos/edx/bok-choy/pulls/comments/40349789"},"html":{"href":"https://github.com/edx/bok-choy/pull/109#discussion_r40349789"},"pull_request":{"href":"https://api.github.com/repos/edx/bok-choy/pulls/109"}}},"pull_request":{"url":"https://api.github.com/repos/edx/bok-choy/pulls/109","id":45212627,"html_url":"https://github.com/edx/bok-choy/pull/109","diff_url":"https://github.com/edx/bok-choy/pull/109.diff","patch_url":"https://github.com/edx/bok-choy/pull/109.patch","issue_url":"https://api.github.com/repos/edx/bok-choy/issues/109","number":109,"state":"open","locked":false,"title":"Make axe-core ruleset default in accessibility audit","user":{"login":"clytwynec","id":3818105,"avatar_url":"https://avatars.githubusercontent.com/u/3818105?v=3","gravatar_id":"","url":"https://api.github.com/users/clytwynec","html_url":"https://github.com/clytwynec","followers_url":"https://api.github.com/users/clytwynec/followers","following_url":"https://api.github.com/users/clytwynec/following{/other_user}","gists_url":"https://api.github.com/users/clytwynec/gists{/gist_id}","starred_url":"https://api.github.com/users/clytwynec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clytwynec/subscriptions","organizations_url":"https://api.github.com/users/clytwynec/orgs","repos_url":"https://api.github.com/users/clytwynec/repos","events_url":"https://api.github.com/users/clytwynec/events{/privacy}","received_events_url":"https://api.github.com/users/clytwynec/received_events","type":"User","site_admin":false},"body":"Refactors the accessibility auditing feature to allow use of either the google accessibility dev tools ruleset or dequelab's axe-core ruleset.  See updated docs/docstrings for details about implementation and usage.\r\n\r\nThe output for the google accessibility tools ruleset remains the same.  The output for the newly implemented axe-core ruleset looks something like the following:\r\n\r\n```\r\nAccessibilityError: URL 'http://localhost:8003/accessibility.html' has 6 errors:\r\n\r\nRule ID: aria-roles\r\nHelp URL: https://dequeuniversity.com/rules/axe/1.1/aria-roles\r\n\r\n\tMessage: \r\n\tHtml: <div id=\"AX_ARIA_01_not_a_role\" role=\"datepicker\"></div>\r\n\tTarget: [u'#AX_ARIA_01_not_a_role']\r\n\r\n\tMessage: \r\n\tHtml: <div id=\"AX_ARIA_01_empty_role\" role=\"\"></div>\r\n\tTarget: [u'#AX_ARIA_01_empty_role']\r\n\r\nRule ID: aria-valid-attr-value\r\nHelp URL: https://dequeuniversity.com/rules/axe/1.1/aria-valid-attr-value\r\n\r\n\tMessage: Invalid ARIA attribute value: aria-hidden=\"yes\"\r\n\tHtml: <span id=\"AX_ARIA_04_bad\" aria-hidden=\"yes\">foo</span>\r\n\tTarget: [u'#AX_ARIA_04_bad']\r\n\r\nRule ID: button-name\r\nHelp URL: https://dequeuniversity.com/rules/axe/1.1/button-name\r\n\r\n\tMessage: Element does not have inner text that is visible to screen readers\r\n\tHtml: <div id=\"AX_ARIA_01_01\" role=\"button\"></div>\r\n\tTarget: [u'#AX_ARIA_01_01']\r\n\r\nRule ID: html-lang\r\nHelp URL: https://dequeuniversity.com/rules/axe/1.1/html-lang\r\n\r\n\tMessage: The <html> element does not have a lang attribute\r\n\tHtml: <html>\r\n\tTarget: [u'html']\r\n\r\nRule ID: link-name\r\nHelp URL: https://dequeuniversity.com/rules/axe/1.1/link-name\r\n\r\n\tMessage: Element does not have text that is visible to screen readers\r\n\tHtml: <a href=\"#\" style=\"color: white; background-color: white;\"></a>\r\n\tTarget: [u'#bad-link > a']\r\n```","created_at":"2015-09-16T19:17:20Z","updated_at":"2015-09-24T17:55:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41576e3bb94ea0eed440019e59bed0057885bb7c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/bok-choy/pulls/109/commits","review_comments_url":"https://api.github.com/repos/edx/bok-choy/pulls/109/comments","review_comment_url":"https://api.github.com/repos/edx/bok-choy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/bok-choy/issues/109/comments","statuses_url":"https://api.github.com/repos/edx/bok-choy/statuses/f09f39d75631144222075b694165d5899dd7629f","head":{"label":"edx:clytwynec/axe-core-ruleset","ref":"clytwynec/axe-core-ruleset","sha":"f09f39d75631144222075b694165d5899dd7629f","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":14694865,"name":"bok-choy","full_name":"edx/bok-choy","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/bok-choy","description":"UI-level acceptance test framework","fork":false,"url":"https://api.github.com/repos/edx/bok-choy","forks_url":"https://api.github.com/repos/edx/bok-choy/forks","keys_url":"https://api.github.com/repos/edx/bok-choy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/bok-choy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/bok-choy/teams","hooks_url":"https://api.github.com/repos/edx/bok-choy/hooks","issue_events_url":"https://api.github.com/repos/edx/bok-choy/issues/events{/number}","events_url":"https://api.github.com/repos/edx/bok-choy/events","assignees_url":"https://api.github.com/repos/edx/bok-choy/assignees{/user}","branches_url":"https://api.github.com/repos/edx/bok-choy/branches{/branch}","tags_url":"https://api.github.com/repos/edx/bok-choy/tags","blobs_url":"https://api.github.com/repos/edx/bok-choy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/bok-choy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/bok-choy/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/bok-choy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/bok-choy/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/bok-choy/languages","stargazers_url":"https://api.github.com/repos/edx/bok-choy/stargazers","contributors_url":"https://api.github.com/repos/edx/bok-choy/contributors","subscribers_url":"https://api.github.com/repos/edx/bok-choy/subscribers","subscription_url":"https://api.github.com/repos/edx/bok-choy/subscription","commits_url":"https://api.github.com/repos/edx/bok-choy/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/bok-choy/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/bok-choy/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/bok-choy/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/bok-choy/contents/{+path}","compare_url":"https://api.github.com/repos/edx/bok-choy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/bok-choy/merges","archive_url":"https://api.github.com/repos/edx/bok-choy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/bok-choy/downloads","issues_url":"https://api.github.com/repos/edx/bok-choy/issues{/number}","pulls_url":"https://api.github.com/repos/edx/bok-choy/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/bok-choy/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/bok-choy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/bok-choy/labels{/name}","releases_url":"https://api.github.com/repos/edx/bok-choy/releases{/id}","created_at":"2013-11-25T18:51:25Z","updated_at":"2015-08-04T22:19:43Z","pushed_at":"2015-09-23T13:29:20Z","git_url":"git://github.com/edx/bok-choy.git","ssh_url":"git@github.com:edx/bok-choy.git","clone_url":"https://github.com/edx/bok-choy.git","svn_url":"https://github.com/edx/bok-choy","homepage":null,"size":1676,"stargazers_count":28,"watchers_count":28,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":6,"forks":23,"open_issues":6,"watchers":28,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"e61b5e1bc81f77c6dc9cc1872f167ed7feb9fcec","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":14694865,"name":"bok-choy","full_name":"edx/bok-choy","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/bok-choy","description":"UI-level acceptance test framework","fork":false,"url":"https://api.github.com/repos/edx/bok-choy","forks_url":"https://api.github.com/repos/edx/bok-choy/forks","keys_url":"https://api.github.com/repos/edx/bok-choy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/bok-choy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/bok-choy/teams","hooks_url":"https://api.github.com/repos/edx/bok-choy/hooks","issue_events_url":"https://api.github.com/repos/edx/bok-choy/issues/events{/number}","events_url":"https://api.github.com/repos/edx/bok-choy/events","assignees_url":"https://api.github.com/repos/edx/bok-choy/assignees{/user}","branches_url":"https://api.github.com/repos/edx/bok-choy/branches{/branch}","tags_url":"https://api.github.com/repos/edx/bok-choy/tags","blobs_url":"https://api.github.com/repos/edx/bok-choy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/bok-choy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/bok-choy/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/bok-choy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/bok-choy/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/bok-choy/languages","stargazers_url":"https://api.github.com/repos/edx/bok-choy/stargazers","contributors_url":"https://api.github.com/repos/edx/bok-choy/contributors","subscribers_url":"https://api.github.com/repos/edx/bok-choy/subscribers","subscription_url":"https://api.github.com/repos/edx/bok-choy/subscription","commits_url":"https://api.github.com/repos/edx/bok-choy/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/bok-choy/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/bok-choy/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/bok-choy/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/bok-choy/contents/{+path}","compare_url":"https://api.github.com/repos/edx/bok-choy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/bok-choy/merges","archive_url":"https://api.github.com/repos/edx/bok-choy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/bok-choy/downloads","issues_url":"https://api.github.com/repos/edx/bok-choy/issues{/number}","pulls_url":"https://api.github.com/repos/edx/bok-choy/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/bok-choy/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/bok-choy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/bok-choy/labels{/name}","releases_url":"https://api.github.com/repos/edx/bok-choy/releases{/id}","created_at":"2013-11-25T18:51:25Z","updated_at":"2015-08-04T22:19:43Z","pushed_at":"2015-09-23T13:29:20Z","git_url":"git://github.com/edx/bok-choy.git","ssh_url":"git@github.com:edx/bok-choy.git","clone_url":"https://github.com/edx/bok-choy.git","svn_url":"https://github.com/edx/bok-choy","homepage":null,"size":1676,"stargazers_count":28,"watchers_count":28,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":6,"forks":23,"open_issues":6,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/bok-choy/pulls/109"},"html":{"href":"https://github.com/edx/bok-choy/pull/109"},"issue":{"href":"https://api.github.com/repos/edx/bok-choy/issues/109"},"comments":{"href":"https://api.github.com/repos/edx/bok-choy/issues/109/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/bok-choy/pulls/109/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/bok-choy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/bok-choy/pulls/109/commits"},"statuses":{"href":"https://api.github.com/repos/edx/bok-choy/statuses/f09f39d75631144222075b694165d5899dd7629f"}}}}