Scanyp provides the capability for a threshold feature. This feature functions as a quality check for code, which needs to be satisfied prior to the software's release and ideally before the code is committed to the source control. Essentially, a threshold serves as a clear PASS/FAIL metric for software quality.
You can effortlessly set up a threshold through the Admin -> Threshold tab.
The threshold is characterized by a python function known as 'gatefunction'. This function is required to return three distinct components - a status, a message, and a detailsQuery - which furnish additional insights into the threshold.
def gatefunction(application):
status="Pass"
message="No critical issue found."
detailsQuery="Team Critical Issues"
criticalissues=[{'issue':issue,'Debt':issue.Debt} for issue in application.Issues if issue.Severity=="Critical" ]
if(len(criticalissues))>10:
message="More than 10 critical issues are found."
status="Fail"
elif(len(criticalissues)>0):
message="At least 1 critical issue is found."
status="Warn"
return status,message,detailsQuery