) &&
(!data.severity || currentActivation.severity === data.severity) &&
currentActivation.prioritizedRule === data.prioritizedRule &&
- (!data.softwareQualityImpact ||
+ (!data.impacts ||
isEqual(
currentActivation.impacts,
- Object.entries(data.softwareQualityImpact).map(([softwareQuality, severity]) => ({
+ Object.entries(data.impacts).map(([softwareQuality, severity]) => ({
softwareQuality,
severity,
})),
const inheritedImpacts =
this.rulesActivations[data.rule]?.find(({ qProfile }) => qProfile === data.key)?.impacts ??
[];
- const severity = data.softwareQualityImpact
- ? MQRtoStandardSeverityMap[data.softwareQualityImpact[SoftwareQuality.Maintainability]]
+ const severity = data.impacts
+ ? MQRtoStandardSeverityMap[data.impacts[SoftwareQuality.Maintainability]]
: data.severity;
const impacts = data.severity
? [
StandardtoMQRSeverityMap[data.severity as keyof typeof StandardtoMQRSeverityMap],
},
]
- : Object.entries(data.softwareQualityImpact ?? {}).map(
+ : Object.entries(data.impacts ?? {}).map(
([softwareQuality, severity]: [SoftwareQuality, SoftwareImpactSeverity]) => ({
softwareQuality,
severity,
}
export interface ActivateRuleParameters {
+ impacts?: Record<SoftwareQuality, SoftwareImpactSeverity>;
key: string;
params?: Record<string, string>;
prioritizedRule?: boolean;
reset?: boolean;
rule: string;
severity?: string;
- softwareQualityImpact?: Record<SoftwareQuality, SoftwareImpactSeverity>;
}
export function activateRule(data: ActivateRuleParameters) {
const params =
data.params && map(data.params, (value, key) => `${key}=${csvEscape(value)}`).join(';');
- const softwareQualityImpact =
- data.softwareQualityImpact &&
- map(data.softwareQualityImpact, (value, key) => `${key}=${value}`).join(';');
+ const impacts = data.impacts && map(data.impacts, (value, key) => `${key}=${value}`).join(';');
return post('/api/qualityprofiles/activate_rule', {
...data,
params,
- softwareQualityImpact,
+ impacts,
}).catch(throwGlobalError);
}