Allow configuring the number of failing elements shown per audit rule in report
Numbers impacting the resulting built axs_testing.js is here: https://github.com/GoogleChrome/accessibility-developer-tools/blob/master/src/js/Audit.js#L330 https://github.com/GoogleChrome/accessibility-developer-tools/blob/master/src/js/Audit.js#L334
improvements:
- Make the variable configurable,
- Configuration option to remove the upper limit (so that the log displays all the found issues per error type).
I'm still thinking about whether using 0 to signify no upper limit makes sense, but that shouldn't prevent you from working on this.
Also, it probably doesn't make sense to do this in AuditConfiguration after all, since it won't affect anything about running the actual audit. It should probably be passed directly to axs.Audit.createReport() - possibly that should take its own configuration object?
Hmm, as in, when we call axs.Audit.createReport we could pass an integer as a parameter that would generate "1" or "10" or "99" "failing elements shown per audit rule" ?
That would be easier to use.
So if no parameter is passed == no limit If integer is passed == that would be the upper limit
Updated the issue description, removed explicit mention of "0" as solution.
Unfortunately I don't think it's quite that simple - I'd like to keep 5 as the default. So we still need to come up with a way to express "no limit". One alternative might be to just explicitly pass Number.MAX_VALUE but that seems a little awkward.
what about passing -1 to return all results?
@Pikaling Yeah, that's one of the options I'm considering.
It would be good to understand the use case for printing out potentially hundreds of elements - this can't possibly be human-readable, and if it's for machine consumption it would be better to pass the result object directly, rather than need to parse the report format.
If there's no actual use case for it, I think the most sensible option might be to allow configuration in a fixed range from 0 (print the failing rule names and info only) to some semi-arbitrary maximum (say, 100).
In my case I want to be able to run the audit as part of a build, but unlike a regular test suite you wouldn't be able to pass or fail, you'd just generate the report and a developer would check it and make changes where necessary. So I'd like a report where I could see every element that fails the test, and decide whether to add it to the config as a selector or rule to ignore, or change it so it passes the test. At the moment limiting it to 5 items makes it difficult to asses the page properly.
Ah, thanks for the explanation.
I agree 5 is probably too small a number for that, but with each extra element result you add, you're also reducing the ability to look at the report at a glance. Also, in the vast majority of cases you're not fixing individual elements, but fixing logic (whether HTML, JS or CSS) which will cause a whole set of elements to no longer fail the audit.
My usual mechanism is to attempt to fix one problem at a time and then run the audit again to check the fix; if it's fixed, I'll see new elements show up in the results, and if it's not fixed then I still have to fix it, and I'm not interested in other failures.
So, I'm still not convinced of the utility of seeing every single failing element in the report. I'm certainly happy to make it configurable, but I think it makes sense to have a maximum bound on the number of elements shown. I'm still willing to be convinced otherwise, though.
I think it should be up to the person running the script to decide whether they want to see all the issues or not. I don't see any harm in including it as an option - if you don't want to see all results, then you can specify you're own max.
The harm is that it could take quite a long time to generate all that text (the query selector generator is not especially efficient), and then you're also passing around a potentially giant string.
Are you really sure that you would get significantly more value from seeing literally every single element compared to seeing, say, 100 of them? What is the workflow you have in mind to make use of the full list?
Can anyone please let me know, how i can get all the results instead of by default 5 results.
I have used the below code, still it shows only 5 results. var auditConfig = new axs.AuditConfiguration({ maxResults: 10})
Can anyone please let me know, how i can get all the results instead of by default 5 results.
I have used the below code, still it shows only 5 results. var auditConfig = new axs.AuditConfiguration({ maxResults: 10})
I am looking for at least 20 results instead of 5(By default)