Question?
How can I verify that the library score for my application is correct?
Answer?
Information on Library scoring can be found in the Contrast Documentation at:
Library scoring guide
An applications Library Score is calculated by adding together the all the Public libraries scores and then dividing this by the number of Public libraries.
Take the following example where an application contains 258 Public libraries, consisting of libraries with the below score breakdown:
32 * 1 (1 library with a score of 32)
+ 42 * 1 (1 library with a score of 42)
+ 50 * 2 (2 libraries with a score of 50)
+ 60 * 1 (1 library with a score of 60)
+ 100 * 253 (253 libraries with a score of 100)
-----------
= 25,474 (Total score of Public Libraries)
/ 258 (Number of Public Libraries)
-----------
= 98.7 (Application Library Score: A)
The web browsers Developer Tools can be used to view the results of the libraries/filter API call:
The following cURL request will also return the list of Public libraries for a given application:
curl -X GET \
"https://{TEAMSERVER_HOST}/Contrast/api/ng/{ORG_ID}/libraries/filter?quickFilter=PUBLIC&apps={APP_ID}" \
-HAuthorization:{AUTH} \
-HAPI-Key:{API_KEY} \
-H "Content-Type: application/json"
The response will contain grade
and score
data for each Public library in the application.