Branch Analyses

Many organizations are transitioning to short-lived feature branches and employ practices like continuous integration/delivery. To work in practice, branches have to be kept short-lived.

CodeScene introduces a new suite of analyses that measure branching activity, different lead times, and risks. This is information you can use to get insights into your CI/CD process, or to reason about delivery and development risks.

Meet the Branch Measures

CodeScene presents a summary of the branch statistics on its dashboard as shown in Fig. 95.

An overview of the branch measures

Fig. 95 An overview of the branch measures.

By default, CodeScene calculates statistics for all branches that have been worked on during the past two months. Use this high-level overview to ensure you have short development durations and short lead times to merge for each branch. As soon as a branch lasts too long, it puts your delivery at risk due to merge conflicts and unexpected feature interactions.

As you see in the preceding figure, CodeScene also auto-detects early warnings for long lived branches. Use this information to either:

  • Re-plan the scope: Sometimes it’s just too much work in a single feature. Identifying a smaller feature set that you can deliver faster is one way to shorten the lead times and minimize risk.
  • Prioritize verification activities: Use the early warning to focus extra code reviews and tests on the highlighted branches.

If you click on the branch tile on the dashboard, CodeScene displays a detailed view of each branch as shown in Fig. 96.

A detailed analysis of the work on each branch

Fig. 96 A detailed analysis of the work on each branch.

This information lets you identify early signs of trouble, such as long-lived branches, or branches that become congested by attracting contributions from several different authors.

Note that the thresholds used to trigger the early warnings are automatically deduced from your normal branching strategy; CodeScene warns when a branch deviates from your normal ways of working. As such, the warnings are relative to the patterns in your codebase.

You can see another example of such deviations from normal ways of working in Fig. 96: One of the branches has contributions from 5 different developers, which might put you at risk for parallel development. It’s also a sign that there’s too much development activity on that branch, so you could use this information to investigate the scope.

Detect Delivery Risks

CodeScene predicts the delivery risk of each active branch (i.e. unmerged work) as shown in Fig. 97.

Risk classification of each branch

Fig. 97 Predict the delivery risk of each branch.

This risk classification predicts the risk for defects, and is given on the scale 1-10 where 10 is the highest risk.

Use this information to plan preventive measures such as extra code reviews and tests. You can also setup a separate CodeScene analysis and just focus on the work being done on the branch. In extreme cases you may chose to postpone the merge of such high-risk branches if you’re close to a critical deadline.

Repo-based Projects

Branch Analyses are not currently supported in Repo-based projects. This is because Repo does not automatically check out a reference branch. For more on using Repo in CodeScene, see Working with Repo.