What is BrowserStack Code Quality Risk Score Risk Score?

The BrowserStack Code Quality Risk Score risk score signifies the urgency of addressing the quality problem on priority. The BrowserStack Code Quality risk score ranges from 5 to 1, where 5 represents high risk and 1 represents a low risk.

How is the BrowserStack Code Quality Risk Score Risk score calculated?

To calculate the risk score BrowserStack Code Quality Risk Score considers the frequency of changes, the number of issues and severity of issue tickets raised against a specific component (or class).

For Version Control System only, the risk score is calculated from the number of commits weighted by the age of each commit. The more recent a commit is, the higher the impact on the risk score. Each commit and its age will be calculated.
Example: A file with 20 commits, all in the last month, has a higher risk than a file with 20 commits a year ago.

If the BrowserStack Code Quality Risk Score is integrated with the ticketing system then more data is available. To calculate the risk score, at the time of scanning BrowserStack Code Quality Risk Score considers all the tickets that had commits to the file. The impact on the risk score is based on the criticality of the ticket.
Example: A year-old Blocker Bug will create more Risk than a one-month-old Trivial Feature. In this equation, time is no factor because the criticality still applies, if the ticket haven’t been deleted.

Why refactoring is important while calculating the risk score?

If a bad code is not modified frequently, it has a smaller impact on the overall system. The rule of thumb is: if you modify a file more than five times, refactor it to obtain an average positive return on investment. Learning from the Version Control System and Jira history of each file, with risk score BrowserStack Code Quality Risk Score determines where the code has a higher possibility of changes and its importance on the overall system.