Menu

#19 Zero lines counted int Obj c code

open
nobody
None
5
2015-02-17
2015-01-15
No

I have a file TestClass.m written in Objective-C with following contents:

#import "TestClass.h"

NSString *const ADDITION_SFX = @"123321";

@implementation TestClass

+ (NSString*) testMethod:(NSString*)originalString
{
    NSString *resultString = nil;
    if (originalString != nil && originalString.length > 0) {
        resultString = [NSString stringWithFormat:@"%@ + %@", originalString, ADDITION_SFX];
    } else {
        resultString = @"";
    }
    return resultString;
}

@end

When I count lines for it, I'm having zero output:

andreys-imac:TestProject andreymanov$ sloccount TestClass.m 
Have a non-directory at the top, so creating directory top_dir
Adding /Users/andreymanov/Documents/projects/iOSWorkspace/TestProject/TestClass.m to top_dir
Categorizing files.
Computing results.


SLOC    Directory   SLOC-by-Language (Sorted)
0       top_dir         (none)
SLOC total is zero, no further analysis performed.

Though when I'm adding one more method in the file, it starts working correct.

TestClass2.m

#import "TestClass.h"

NSString *const ADDITION_SFX = @"123321";

@implementation TestClass

+ (void) initialize {
}

+ (NSString*) testMethod:(NSString*)originalString
{
    NSString *resultString = nil;
    if (originalString != nil && originalString.length > 0) {
        resultString = [NSString stringWithFormat:@"%@ + %@", originalString, ADDITION_SFX];
    } else {
        resultString = @"";
    }
    return resultString;
}

@end

Output:

~~~~~~
andreys-imac:TestProject andreymanov$ sloccount TestClass2.m
Have a non-directory at the top, so creating directory top_dir
Adding /Users/andreymanov/Documents/projects/iOSWorkspace/TestProject/TestClass2.m to top_dir
Categorizing files.
Finding a working MD5 command....
Found a working MD5 command.
Computing results.

SLOC Directory SLOC-by-Language (Sorted)
16 top_dir objc=16

Totals grouped by language (dominant language first):
objc: 16 (100.00%)

Total Physical Source Lines of Code (SLOC) = 16
Development Effort Estimate, Person-Years (Person-Months) = 0.00 (0.03)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC1.05))
Schedule Estimate, Years (Months) = 0.06 (0.67)
(Basic COCOMO model, Months = 2.5 * (person-months
0.38))
Estimated Average Number of Developers (Effort/Schedule) = 0.05
Total Estimated Cost to Develop = $ 352
(average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
~~~~~

Discussion


Log in to post a comment.

MongoDB Logo MongoDB