sscargal / pmemchk

MIT License
0 stars 1 forks source link

[Analyzer] Implement rule result functions to handle stats and messages #140

Closed sscargal closed 2 years ago

sscargal commented 2 years ago

Rules commonly have the following code that returns a PASS/FAIL to the user and bumps the stats counters:

  # Return the final PASS/INFO to the user
  if [ "${ERR_STATE}" = true ] ; then
    info_msg "One or more PMem modules reported > 0.000 GiB ReservedCapacity"
    REPORT_COUNT_INFO=$((REPORT_COUNT_INFO+1))
  else
    echo "${STR_PASSED} ${FUNCNAME[0]} : No PMem modules have ReservedCapacity configured"
    REPORT_COUNT_PASSED=$((REPORT_COUNT_PASSED+1))
  fi

It would be more efficient (Don't Repeat Yourself) to call functions that: