The overall rating is derived from four sub-ratings: Design (anti-pattern), Metrics, Duplication, and Code Quality (code issues). These sub-ratings are again calculated for all components (functions or classes) and then aggregated for packages (or modules) and for the overall repository. Our proprietary quality parameters specify how each sub-ratings is weighted in order to derive the overall BrowserStack Code Quality rating.

Code Metrics

Code Metrics are measures for quantitatively assessing your source code. BrowserStack Code Qualitycalculates a large number of metrics, i.e. Lines of Code, Cyclomatic Complexity, or Depth of Inheritance hierarchy. For each metrics, there are pre-defined thresholds that are documented in the metrics section of the documentation. The more a certain metric is breached, the bigger the negative impact on the BrowserStack Code Quality rating.

Duplication

Duplication defines how much of your code is duplicated in one or more places. The higher the duplicated code, the more impact on the core.

Code Issues

Code issues are detected by checking the code against pre-defined rules. Each code issue has a severity as critical, high, medium, or low. Critical issues have a higher impact on the rating than low severity issues obviously!

Design and architecture

The design and architecture of your code are evaluated by detecting anti-patterns that identify structural issues within your source code. There are function/method level anti-patterns and component-level design issues. Component level design issues have a significant impact on the rating. Additionally, each anti-pattern is assigned high, medium, or low severity. High severity design issues have a significant impact than low severity issues.