Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sscargal opened this issue May 5, 2022 · 0 comments · Fixed by #145
Closed

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

sscargal opened this issue May 5, 2022 · 0 comments · Fixed by #145
Labels
enhancement New feature or request

Comments

@sscargal
Copy link
Owner

sscargal commented May 5, 2022

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:

  • Print the message with the appropriate message type (Info, Warn, Crit, Pass, Fail, Skipped)
  • Bump the stats counter for the result type (Info, Warn, Crit, Pass, Fail, Skipped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant