OCLint用法示例

时间:2012-11-15 17:21:28

标签: objective-c static-code-analysis

我正在寻找一个关于如何配置OCLint或如何让它运行的示例。我搜索但没有。在Stack Overflow上只有3个帖子相关,只是命名图书馆和谷歌只是官方OCLint.org

官方文件说:

[user@localhost ~]$ oclint -help
OVERVIEW: OCLint, a static code analysis tool for Objective-C and related languages

USAGE: oclint [options] <input files>

OPTIONS:
  -D <macro>               - Predefine the specified macro
  -F <directory>           - Add directory to framework include search path
  -I <directory>           - Add directory to include search path
  -R <directory>           - Add directory to rule loading path
  -arch <arch_name>        - Specify which architecture (e.g. ppc, i386, x86_64, armv7) the compilation 
                             should targets.
  -help                    - Display available options (-help-hidden for more)
  -include <file>          - Include file before parsing
  -isysroot <directory>    - Add directory to SYSTEM include search path
  -o <file>                - Write output to <file>
  -rc <paramemter>=<value> - Change the baheviour of rules
  -stats                   - Enable statistics output from program
  Choose report type:
    -text                  - Plain text report
    -html                  - HTML formatted report
  -version                 - Display the version of this program
  -x <value>               - Input language type

但我想更好地解释宏(-D),以及选择-I,-F,-R的路径以及我应该指出什么。代码示例为

$ oclint path/to/file.m -D something -I something -F something -R something

预期的输出效果会非常好。

1 个答案:

答案 0 :(得分:1)

基本上你只需要给你的编译器提供oclint

或者,如果您不熟悉编译器标志,则可能需要尝试oclint-xcodebuild。这是一个Python脚本,用于从Xcode构建日志文件中提取标志。请参阅用法here