我在OSX上使用了很多关于Objective-C项目的sloccount,直到最近我才升级到OSX 10.9 Mavericks。当我试图运行这个简单的脚本时:
#!/bin/sh
sloccount --duplicates --wide --details WeatherApp > Build/sloccount.sc
我得到了这个:
/Applications/sloccount/compute_sloc_lang: line 52: c_count: command not found
Warning! No 'Total' line in Models/ansic_outfile.dat.
输出文件包含:
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
Jenkins的Sloccount插件无法解析它。
对此有何看法?
答案 0 :(得分:1)
我最终使用CLOC(http://cloc.sourceforge.net/)代替SLOCCount(http://www.dwheeler.com/sloccount/)。
我找不到CLOC的Jenkins插件,所以我使用xsltproc将CLOC输出转换为SLOCCount输出格式。
我正在使用以下脚本(https://github.com/Ruenzuo/north-american-ironman/blob/master/Scripts/Sloccount.sh),随意使用它。您还需要此文件(https://github.com/Ruenzuo/north-american-ironman/blob/master/Utils/Sloccount-format.xls)。
希望这有助于某人。
答案 1 :(得分:1)
可能缺少的一步是在您下载存档
之后您需要运行 make install ,这会构建缺少的exe或二进制文件,并将sloccount实用程序和手册页部署到/ usr / local / bin