{"id":19107269,"url":"https://github.com/govtechsg/purple-a11y-axe-core-rules","last_synced_at":"2025-08-01T11:35:37.164Z","repository":{"id":194521384,"uuid":"689821382","full_name":"GovTechSG/purple-a11y-axe-core-rules","owner":"GovTechSG","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-18T06:32:18.000Z","size":27,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T03:13:03.886Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GovTechSG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-11T01:17:10.000Z","updated_at":"2024-02-15T07:32:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c982146-e113-43bf-8f63-27aca4c2562e","html_url":"https://github.com/GovTechSG/purple-a11y-axe-core-rules","commit_stats":null,"previous_names":["thumster/extract-axe-core-rules","govtechsg/purple-a11y-axe-core-rules"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GovTechSG%2Fpurple-a11y-axe-core-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GovTechSG%2Fpurple-a11y-axe-core-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GovTechSG%2Fpurple-a11y-axe-core-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GovTechSG%2Fpurple-a11y-axe-core-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GovTechSG","download_url":"https://codeload.github.com/GovTechSG/purple-a11y-axe-core-rules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240161711,"owners_count":19757875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T04:11:58.803Z","updated_at":"2025-02-22T10:29:16.659Z","avatar_url":"https://github.com/GovTechSG.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extract Axe Core Rules\n\nThis tool aims to make extracting and analyzing axe-core rules easier.\nIt makes use of axe-core's repository and checkouts to respective branches\nto extract the information of rules. Furthermore, it is able to map the rules\nto their respective checks.\n\nAnother use case would be for version upgrades of axe-core. This tool provides\nfunctionality to create a diff comparison of 2 different versions.\n\n## Getting Started\n\n### Axe-Core Submodule\n\nOnly on first installation\n\n```shell\ngit submodule init\n```\n\nOn subsequent uses before you run, execute this command to update the axe-core submodule.\n\n```shell\ngit submodule update\n```\n\n### Installing Dependencies\n\n```\nnpm install\n```\n\n## How to Run\n\n```shell\nOptions:\n-m --mode mode of result file. extraction - extract for a single version\n                             diff - generates diff file for two versions\n                  [choices: \"extraction\", \"diff\"] [default: \"extraction\"]\n-t, --type type of extraction of axe-core rules and checks\n[choices: \"complete\", \"incomplete\", \"information\"] [default: \"complete\"]\n-v, --version version of axe-core to extract          [default: \"master\"]\n-a, --versionAfter version of axe-core to compare diff. only for diff mode\n--help Show help [boolean]\n\nExamples:\n# Extract all rules of axe-core v4.7.2\nnode index.js -t complete -v v4.7.2\n\n# Extract all incomplete rules of axe-core master\nnode index.js -m 1 -t incomplete\n\n# Generate diff for complete rules of axe-core v4.6.2 and v4.7.2\nnode index.js -m diff -t complete -v v4.6.2 -a v4.7.2\n```\n\nAll files can be found in the `results` folder in the main directory.\n\n## Types\n\n### incomplete\n\nResult file name: `results/incomplete_rules*.json`\n\nThe goal is to extract information from rules and checks to be able to assess findings\nwith needs review.\n\nOnly rules that meet either of this criteria are extracted:\n\n1. Rules that have checks with incomplete messages\n2. Rules with `reviewOnFail` and all the fail messages of the checks under the rule\n\nNote: Enabled (false) and Experimental rules are still extracted but indicated respectively.\nThese rules are not run by default.\n\n### complete\n\nResult file name: `results/complete_rules*.json`\n\nThe goal is to extract information from rules to assess impacts of version upgrades.\n\nAll rules are to be extracted along with the check ids in all/any/none.\n\nNote: Enabled (false) and Experimental rules are still extracted but indicated respectively.\nThese rules are not run by default.\n`reviewOnFail` is also extracted to indicate rules that return as \"Needs Review\" on failure.\n\n### information\n\nResult file name: `information_rules*.json, information_issues*.md`\nThe goal is to extract information of rules to understand what axe-core checks for.\nThe axe-core impact of each rule are mapped to Purple Hats severity levels (Must Fix, Good to Fix).\n\nOnly rules that meet either of this criteria are extracted:\n\n1. Rules that are enabled\n2. Rules that are not experimental\n\nFurthermore, a markdown is produced with the results categorised by their respective standards.\n\n## Customizing\n\nTo customize and create a new extractor based on certain filters or logic.\nYou can do so by adding to the `extractors` folder. For e.g. If you want to\ncreate an extractor that only has checks with `pass` messages.\n\n1. Create a new file for the extractor `extractors/myCustomExtractor.js`\n2. Ensure that the file exports the necessary variables and implementation\n\n```js\nconst myCustomExtractor = {\n  // file name for generated file\n  fileName,\n  /* \n   Reducer when looping through checks impl of what to filter/map should be contained here\n   (checkAcc, data) =\u003e {checkAcc}\n  */\n  checkReducer,\n  /* \n   Accumlator object that will be passed to checkReducer\n   You can use arrays or objects\n  */\n  checkAcc: {},\n  /* \n   Reducer when looping through rules impl of what to filter/map should be contained here\n   The final reduced check accumulator will also be passed\n   (checkAcc) =\u003e (ruleAcc, data) =\u003e {ruleAcc}\n  */\n  ruleReducer,\n  /* \n   Accumlator object that will be passed to ruleReducer\n   You can use arrays or objects\n  */\n  ruleAcc: {},\n  /* \n   Result from ruleReducer (if exists) or checkReducer will be passed to this function and executed.\n   E.g. for information type, the markdown file is generated here.\n   postOp = (ruleAcc, axeVersion)\n  */\n  postOp,\n};\n\nexport default myCustomExtractor;\n```\n\nNote: All these fields are optional. If not provided, the step will be skipped.\n\n3. Export the extractor in [`extractors/index.js`](extractors/index.js)\n\n```js\nexport { default as custom } from \"./myCustomExtractor.js\";\n```\n\n4. Add the new extractor type to `type` for `cliOptions` in [`index.js`](index.js)\n\n```js\n  const cliOptions = {\n  .\n  .\n  t: {\n    alias: \"type\",\n    describe: \"type of extraction of axe-core rules and checks\",\n    choices: [\"complete\", \"incomplete\", \"custom\"],\n    default: \"complete\",\n  },\n  .\n  .\n  }\n```\n\n5. Run the your new custom extractor\n\n```shell\nnode index.js -t custom -v v4.8.0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgovtechsg%2Fpurple-a11y-axe-core-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgovtechsg%2Fpurple-a11y-axe-core-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgovtechsg%2Fpurple-a11y-axe-core-rules/lists"}