Calculate Lines of Code Metric For SVN Branches

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

The value for the LOC (Lines of Code) metric is zero (0) for an SVN repository even though "Activity" shows current subversion commits.

Cause

Fisheye only counts lines of code checked into the trunk.

Resolution

In order for Fisheye to start counting the branches LOC, the Symbolic Links will need to be customized. This can be done under Administration > Repository Settings > Repositories, click on the repository name SCM Details > SVN Symbolic Rules. The screen has a placeholder for Trunk, for Branches and for Tags. Select "Custom" from the drop-down and click "Add" (the right-most link creates a new row) to have another line for Trunk. Populate it with the pattern of the branch to be included in the LOC metric. De-select the option "Use Built-in Symbolic Rules" before pressing "Save". For more details please refer to the following pages:

The following example shows a set up including a branch. Note that all branches could be included in the LOC count if the "a_branch_to_count_lines/" part is removed:

TypeRegular ExpressionNameLogical Path Prefix
Trunktrunk(/|$)trunk 
Trunkbranches/a_branch_to_count_lines/([^/]+)${1}N/A
Branchesbranches/([^/]+)${1}N/A
Tagstags/([^/]+)${1}

N/A

If the trunk and the branch have the exact same code, then the LOC count will be doubled. Separation of trunk LOC and branch LOC can be achieved by keeping two different repositories: one that uses trunk as its official trunk for LOC, and another that ignores trunk and uses the branch definition mapped at the trunk line.

Last modified on Nov 2, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.