Search code examples
iosjenkinsosx-mavericks

Problems with sloccount on OSX Mavericks


I have been using sloccount a lot with Objective-C projects on OSX, never have a problem until recently that I upgraded to OSX 10.9 Mavericks. When I’m trying to run this simple script:

#!/bin/sh
sloccount --duplicates --wide --details WeatherApp > Build/sloccount.sc

I’m getting this:

/Applications/sloccount/compute_sloc_lang: line 52: c_count: command not found
Warning! No 'Total' line in Models/ansic_outfile.dat.

The output file has this:

Creating filelist for Application
Creating filelist for Controllers
Creating filelist for Helpers
Creating filelist for Managers
Creating filelist for Models
Creating filelist for Support
Creating filelist for Views
Categorizing files.
Computing results.


44  objc    Application /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Application/AppDelegate.m
11  objc    Application /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Application/AppDelegate.h
24  objc    Controllers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Controllers/CitiesViewController.m
10  objc    Controllers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Controllers/CitiesViewController.h
74  objc    Helpers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Helpers/TranslatorHelper.m
47  objc    Helpers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Helpers/ValidatorHelper.m
18  objc    Helpers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Helpers/ErrorNotificationHelper.h
21  objc    Helpers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Helpers/TranslatorHelper.h
14  objc    Helpers /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Helpers/ValidatorHelper.h
85  objc    Managers    /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Managers/WeatherAPIManager.m
20  objc    Managers    /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Managers/WeatherAPIManager.h
15  objc    Support /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Support/main.m
13  objc    Support /Users/ruenzuo/Documents/GitHub/north-american-ironman/WeatherApp/Support/Includes.h

And Sloccount Plugin for Jenkins is unable to parse it.

Any thoughts on that?


Solution

  • I finally end using CLOC (http://cloc.sourceforge.net/) instead of SLOCCount (http://www.dwheeler.com/sloccount/).

    I couldn't find a Jenkins plugin for CLOC so I'm using xsltproc to translate CLOC output to SLOCCount output format.

    I'm using the following script (https://github.com/Ruenzuo/north-american-ironman/blob/master/Scripts/Sloccount.sh), feel free to use it. You will also need this file (https://github.com/Ruenzuo/north-american-ironman/blob/master/Utils/Sloccount-format.xls).

    Hope this helps someone.