2

我一直在 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 插件无法解析它。

对此有什么想法吗?

4

2 回答 2

1

下载存档后可能缺少一个步骤

您需要运行make install 这构建缺少的 exe(s) 或二进制文件并将 sloccount 实用程序和手册页部署到 /usr/local/bin

于 2014-07-25T15:51:11.397 回答
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)。

希望这可以帮助某人。

于 2013-11-03T02:11:56.377 回答