com.deque.axe.android.AxeDevToolsConf.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of axe-devtools-android-core Show documentation
Show all versions of axe-devtools-android-core Show documentation
The Axe Devtools Android Core Library
The newest version!
package com.deque.axe.android
import com.deque.axe.android.constants.AxeImpact
object AxeDevToolsConf {
/**
* Filter objects and iterate over them.
* @param filterable The filter.
* @param axeConf The AxeConf object.
* @param The type.
* @return An instance that was filtered.
*/
fun filter(filterable: Filterable, axeConf: AxeConf?): T {
val ignoredRules: MutableSet = HashSet()
axeConf?.rules?.toList()?.forEach { value ->
if (value.second.ignored) {
ignoredRules.add(value.first)
}
}
return filterable.ignoredResults(
ignoredRules,
axeConf != null && axeConf.issueFilterConf.onlyShowResultsVisibleToUser
)
}
/**
* Get the impact for a given rule.
* @param axeConf The AxeConf.
* @param ruleId The ruleId
* @return The impact.
*/
fun getImpactForRule(axeConf: AxeConf, ruleId: String?): Int {
return if (axeConf.rules.containsKey(ruleId)) {
axeConf.rules[ruleId]!!.impact
} else {
AxeImpact.SERIOUS.value
}
}
interface Filterable {
fun ignoredResults(ruleIds: Set, filterOutNonIntractableResults: Boolean): T
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy