Skip to content

Commit

Permalink
update reasonCode mapping #1090
Browse files Browse the repository at this point in the history
  • Loading branch information
shunguoy committed Dec 11, 2024
1 parent b626531 commit ab2c1e6
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions accessibility-checker-engine/src/v4/checker/Checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,27 @@ export class Checker implements IChecker {
}
for (const rsId of rsIds) {
if (rsId in rsInfo) {
Object.keys(rsInfo[rsId]).forEach(code => {
const reCode = new RegExp(`(^|--)${reasonCode}($|--)`);
Object.keys(rsInfo[rsId]).forEach(code => {
let level = null;
const reCode = new RegExp(`(^|--)${reasonCode}($|--)`);
if (code === 'None')
level = rsInfo[rsId]["None"];
else if (reCode.test(code))
level = rsInfo[rsId][code];
if (level === eRulePolicy.VIOLATION) {
retVal = eRulePolicy.VIOLATION;
} else if (level === eRulePolicy.RECOMMENDATION && retVal === null) {
retVal = eRulePolicy.RECOMMENDATION;
} else if (retVal === null) {
retVal = eRulePolicy.INFORMATION;
}
});
level = rsInfo[rsId][code];

if (level !== null) {
if (level === eRulePolicy.VIOLATION) {
retVal = eRulePolicy.VIOLATION;
} else if (level === eRulePolicy.RECOMMENDATION && retVal === null) {
retVal = eRulePolicy.RECOMMENDATION;
} else if (retVal === null) {
retVal = eRulePolicy.INFORMATION;
}
}
});
if (retVal === null) {
retVal = eRulePolicy.INFORMATION;
}
}
}
}
Expand Down

0 comments on commit ab2c1e6

Please sign in to comment.