There are many ways to calculate the number of lines of code, so I don't expect them to be consistent. Computing from the sourceText is not necessarily any better, especially in the case of smalltalk. The sourceText of a smalltalk class is not in a form where a smalltalker would find it easy to predict the #loc, or where she would find it recognizable as a smalltalk class (missing package and superclass)
e.g. Smalltalk::Job CIV#jobAnnouncer block currentValue min max title children isRunning parent process ...
I would either test-drive the different ways of calculating #loc describing what exactly we mean, and making those different calculations available, or not touch it.
There are a.o. - count empty lines - count empty lines beyond end - count empty lines before class start - count license comment - reduce multiple empty lines to one - count method separators - wrap - word-wrap - ignore comments - ignore multi-line comments - map instance variables from string to separate lines - package name
Stephan
On 01/01/17 13:18, Nicolas Anquetil wrote:
Anne spotted a bug in numberOfLinesOfCode.
...
So I propose to remove FAMIXBehaviouralEntity>>numberOfLinesOfCode