If you run tests on parallel jobs (using CI parallelisation) you need to merge CodeClimate reports from each parallel job (CI node) into a unified report.

An additional problem may happen that some of your parallel jobs (one of your parallel CI node) may not have reported CodeClimate result when tests were never executed on that CI node.

It could happen when you run tests with dynamic tests allocation across parallel jobs using  Knapsack Pro Queue Mode. For instance if once of CI node started running tests after other CI nodes already executed the whole test suite distributed for particular CI build then the node has no CodeClimate report.

Here is a list of steps we need to follow to ensure we can correctly prepare a final report for CodeClimate.

  • run tests split across parallel jobs (parallel CI nodes) with dynamic test suite split called Knapsack Pro Queue Mode
  • if one of CI node did not execute tests then knapsack_pro will log info to log file. We should grep the log file and if there were no tests executed then we don’t generate CodeClimate report based on simple-cov
  • as last step we merge all generated CodeClimate reports

Below is the full example for Semaphore CI 2.0 config but it applies to any other CI provider, just use syntax specifically for your CI tool.

#techtips #codeclimate #semaphore #node #nodejs

How to Merge CodeClimate Reports for Parallel Jobs (CI Nodes)
1.25 GEEK