1

I need to customize the ruleset used by pa11y. For instance let's say I want to follow WCAG2A but want to add some rules from WCAG2AA.

I tried with something like this for configuration in my .pa11yci-file:

{
"defaults": {
    "standard": "WCAG2A",
    "rules": ["WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2"],
    "hideElements": "",
    "ignore": [],
    "includeWarnings": true,
    "timeout": 5000,
    "threshold": 0
},
"urls": [
    {
        "url": "https://www.ecster.se",
        "actions": [

        ]
    }]

}

But I only get this in the console:

    Error: Evaluation failed: Error: WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2 is not a valid WCAG 2.0 rule
   at configureHtmlCodeSniffer (<anonymous>:60:13)
   at runPa11y (<anonymous>:30:3)

I get my rulenames from here: https://github.com/pa11y/pa11y/wiki/HTML-CodeSniffer-Rules

Using latest version of pa11y-ci: 2.1.1.

jBoive
  • 1,219
  • 1
  • 14
  • 40

2 Answers2

4

Looking at the Pa11y documentation it looks as though you need to reference rules without the standard.

E.g. Principle1.Guideline1_1.1_1_1.H30.2, not WCAG2AA.Principle1.Guideline1_1.1_1_1.H30.2

Worth noting that that Guideline you've used as an example is already present in both WCAG2A and WCAG2AA. Might be worth trying with one that's only present in AA and above e.g. Principle3.Guideline3_1.3_1_2.H58.1.Lang

Andrew M
  • 96
  • 2
-1

You should have a rules property with an array of rules you wish to include.

...
"rules": [ "standard.you.wish.to.include",...],
... 
arakno
  • 428
  • 3
  • 6
  • Sorry, didn't notice. Have you tried move it to the root object? – arakno May 02 '19 at 14:05
  • Disregard what I said entirely, as it clearly picks it up but it doesn't understand the rule. Does it error with any other rule, or just that one? – arakno May 02 '19 at 14:15