This project is archived and is in readonly mode.
Stats can report negative numbers for LOC/M
Reported by Dan Mayer | January 22nd, 2010 @ 09:17 PM
This occurs when there when there are few lines of code and many methods. It ends up averaging to 0 or 1 LOC per method , but then it does -2 presumable for the original def ... end statement. We noticed various -2 showing up in the stats for projects on Caliper. This is a simple one line patch.
Comments and changes to this ticket
-
Rohit Arondekar October 9th, 2010 @ 03:11 AM
- State changed from new to stale
- Importance changed from to Low
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.
Preferably upload a sample app to Github or attach one here.
-
Vijay Dev February 6th, 2011 @ 09:43 PM
Dan,
Am I missing anything? Shouldn't the subtraction by 2 be removed in this line before you go on to subtract by 2 in a new line?
loc_over_m = (statistics["codelines"] / statistics["methods"]) - 2 rescue loc_over_m = 0
-
Dan Mayer February 8th, 2011 @ 12:36 AM
the -2 removes the def method and end lines when there is a method as they shouldn't count. The issue is when it has 0 or 1 as a result it outputs -1 or -2.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>