Calculate Lines of Code Metric For SVN Branches

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:

Type Regular Expression Name Logical Path Prefix
Trunk trunk(/|$) trunk  
Trunk branches/a_branch_to_count_lines/([^/]+) ${1} N/A
Branches branches/([^/]+) ${1} N/A
Tags tags/([^/]+) ${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 Jul 19, 2016

Was this helpful?

Yes
No
Provide feedback about this article

Not finding the help you need?

Ask the community

Powered by Confluence and Scroll Viewport.