Check result other than boolean?
chalin opened this issue · 3 comments
This is related to the following issue:
For any given project is would be good to know whether it has analytics, and if so, what kind: UA, GA4, GTM or HubSpot. In some cases more than one kind of ID can be present at the same time.
Might it be possible for a "check" to provide information beyond a boolean? In a sense, the result could still be boolean, answering the question "does the website have analytics", but if the answer is "yes", then it could be qualified.
Hi @chalin 👋
Yes, checks can provide information beyond a boolean. Some are already doing that, like the license
check, that verifies if a valid license can be found and captures its SPDX identifier, displaying it in the UI. Some also contain a reference url that can be accessed by clicking on the check (license scanning
, website
, etc), or some additional details, like many of the security checks. Like you said, the final result must still be a boolean, but we include more details in checks often. Please see below all the information a check output can contain at the moment.
pub struct CheckOutput<T = ()> {
pub passed: bool,
pub url: Option<String>,
pub value: Option<T>,
pub details: Option<String>,
pub exempt: bool,
pub exemption_reason: Option<String>,
pub failed: bool,
pub fail_reason: Option<String>,
}
Woohoo! Great, thanks!