Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "impact" field to rules #2644

Closed
connorjclark opened this issue Nov 16, 2020 · 4 comments
Closed

Add "impact" field to rules #2644

connorjclark opened this issue Nov 16, 2020 · 4 comments

Comments

@connorjclark
Copy link
Contributor

connorjclark commented Nov 16, 2020

The doc/rule-descriptions.md file marks each rule's impact. It'd be nice if this was also represented in the lib/rules json files. Lighthouse already uses axe-core's impact / tags to determine how to weigh each rule, and we're looking to automate it with a script to make it more concrete, so I figure this field would be a big help.

@straker
Copy link
Contributor

straker commented Nov 16, 2020

Interesting suggestion. Right now a rules impact is determined at run time by looking through each of its checks and getting the highest impact, so it's not something we could manually add to the rules json file. And since rules and checks can be configured by the user, it's not something we could hard-code either.

@connorjclark
Copy link
Contributor Author

Ah, I hadn't realized that. We could reference the checks of each rule then. Would it be accurate-enough to consider the impact of a rule by using all the checks listed in a rule's all/any/none fields with equal weighting?

@straker
Copy link
Contributor

straker commented Nov 17, 2020

Not sure on the weighting part, but if you were to scan the rule file and get all it's checks, then scan each check JSON file looking at the impact, you could probably deduce the final impact and assign a weight to it.

@straker
Copy link
Contributor

straker commented Nov 25, 2020

It's not the cleanest of code, but here's where we generate a rules impact for the rule description doc. You could probably do something similar to get the final impact level

https://github.com/dequelabs/axe-core/blob/develop/build/configure.js#L238-L263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants