aqa-test-tools icon indicating copy to clipboard operation
aqa-test-tools copied to clipboard

Simplify the logic in PerfCompare.js

Open llxia opened this issue 5 years ago • 0 comments

In PerfCompare.js, we are using undefined, null, "" to represent different meanings. I think we should simplify the logic.

  • [ ] higherbetter should have only two state. i.e., true or false. There is no need to have a third state undefined. The default value for higherbetter in BenchmarkMetric.js should be true. It only needs to set explicitly if it is false.

  • [ ] Remove sepcific checks for undefined, null, "". Update code as the following:

        if (resBenchmarkRunsJson === undefined || (Object.keys(resBenchmarkRunsJson).length === 0 && resBenchmarkRunsJson.constructor === Object) ||
                resBenchmarkRunsJson.baselineCSV === undefined || resBenchmarkRunsJson.testCSV === undefined) {

to

if (!resBenchmarkRunsJson || !resBenchmarkRunsJson.baselineCSV || !resBenchmarkRunsJson.testCSV)

Please check the code and update similar checks.

llxia avatar Mar 11 '20 16:03 llxia