Skip to content

Commit

Permalink
Merge pull request #16 from Endava/feature/add-sonar-coverage-support
Browse files Browse the repository at this point in the history
Fixed minor quality issues
  • Loading branch information
jcendava authored Jun 11, 2024
2 parents 13e64b9 + dd62c18 commit 6aa575d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export const Converter = (config: YourGlobalConfig) => {
...cpuParam,
...memoryParam,
};
cpuEnergy = cpuEnergy ? cpuEnergy : 0;
memoryEnergy = memoryEnergy ? memoryEnergy : 0;
cpuEnergy ??= 0;
memoryEnergy ??= 0;
return useEnergySum ? {energy: cpuEnergy + memoryEnergy} : componentParams;
};

Expand All @@ -160,7 +160,7 @@ export const Converter = (config: YourGlobalConfig) => {
...operationalParam,
...embodiedParam,
};
embodiedEmissions = embodiedEmissions ? embodiedEmissions : 0;
embodiedEmissions ??= 0;

return useCarbonSum
? {carbon: operatingEmissions + embodiedEmissions}
Expand Down Expand Up @@ -215,8 +215,8 @@ export const Converter = (config: YourGlobalConfig) => {

return {
...input,
...getEnergyOutputParams(cpuEnergy, undefined),
...getEmissionOutputParams(operatingEmissions, undefined),
...getEnergyOutputParams(cpuEnergy),
...getEmissionOutputParams(operatingEmissions),
...getCarbonIntensityParam(operatingEmissions, cpuEnergy),
};
});
Expand All @@ -237,7 +237,7 @@ export const Converter = (config: YourGlobalConfig) => {
return {
...input,
...getEnergyOutputParams(undefined, memoryEnergy),
...getEmissionOutputParams(operatingEmissions, undefined),
...getEmissionOutputParams(operatingEmissions),
...getCarbonIntensityParam(operatingEmissions, memoryEnergy),
};
});
Expand All @@ -258,7 +258,7 @@ export const Converter = (config: YourGlobalConfig) => {
return {
...input,
energy: energy,
...getEmissionOutputParams(operatingEmissions, undefined),
...getEmissionOutputParams(operatingEmissions),
...getCarbonIntensityParam(operatingEmissions, energy),
};
});
Expand Down

0 comments on commit 6aa575d

Please sign in to comment.